In order to understand kernel route LC-Trie,
summary the basic functions here.
debug kernel with jprobe
how to use git bisect
usage:
In version management, we often meet this case:
1 | When a line/file is deleted for git repo? |
In this case, we need git bisect.
git bisect startgit bisect good commit_id1git bisect bad commit_id2git bisect bad/good
repeat to step 4, until finish.
more auto method for step4 is run with git bisect run command.
by the way git blame is used to check the added line/file.
Where is IPv6 route cache
Q: Does kernel IPv6 route support route cache ?
yes. but it is very different with IPv4.
It should be ‘clone’ strictly speaking.
For simple let us only focus on ip6_pol_route, and variable struct rt6_info *nrt.
When a route is matched, a
nrtwill be created byrt6_alloc_coworrt6_alloc_clone.the
nrtwill be set with flagRTF_CACHE;ip6_ins_rtinsert the newnrtto fib tree.kernel starts fib6 gc for
nrt.
so there will be a new cache route, and after a period it will disappear.
callback notify when add a IPv4 add
##summary
IP4 route register a call back notify in IPv4 address.
When a address is added, fib_inetaddr_event will be called.
and then 4 route entry maybe added in fib_add_ifaddr
how kernel add a IPv4 address
unregister a net device
unregister_netdev is used to delete a net device. In fact, it equals:
1 | rtnl_lock(); |
a temporary list stores a single net device, which is to be deleted.net_todo_list stores all the net devices are being deleted.
The core function is rollback_registered_many, which efficiently deletes many devices in a list.
But here, in this case, one a single netdevice in the list.
draft: how to select a realtime task when schedule
##summary
There is a struct rt_rq in struct rq. struct rt_rq is used to store all
the realtime task in current struct rq. which has a struct rt_prio_array active.
draft: how to pick next task
summary
There are four sched_class,stop_sched_class --> rt_sched_class --> fair_sched_class --> idle_sched_class
They are linked one by one staticly by struct sched_class->next by their defination.
Each sched_class has method pick_next_task, which is used to select
a perfect process to run from each sched_class‘s runqueue.
When we need schedule, the four pick_next_task will be called one by one.
As a optimization, most time there is no rt task in running state,
in this case we can directly call fair_sched_class.
draft: struct rq
##summary:
- struct rq is basic data structure.
- there is a realtime process(es) and normal process(es) are stored in
different sub-runqueue*_rqof rq?1
2426 struct cfs_rq cfs;
427 struct rt_rq rt;
