how to use git bisect

usage:

In version management, we often meet this case:

1
2
3
When a line/file is deleted for git repo?
or
who did it ?

In this case, we need git bisect.

  1. git bisect start
  2. git bisect good commit_id1
  3. git bisect bad commit_id2
  4. git 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.

Read More

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.

  1. When a route is matched, a nrt will be created by rt6_alloc_cow or rt6_alloc_clone.

  2. the nrt will be set with flag RTF_CACHE;

  3. ip6_ins_rt insert the new nrt to fib tree.

  4. kernel starts fib6 gc for nrt.

so there will be a new cache route, and after a period it will disappear.

Read More

unregister a net device

unregister_netdev is used to delete a net device. In fact, it equals:

1
2
3
4
rtnl_lock();
rollback_registered_many( a temp list with a single net device);
list_add_tail(&dev->todo_list, &net_todo_list);
rtnl_unlock();

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.

Read More

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.

Read More