Re: sched_child_runs_first doesn't work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



in my test, it has a chance to get the output from the child first using the taskset command. otherwise, the child and the parent are always on different cores in which case i think the parent is running and the child is on the rbtree of runqueue of other core just after fork at the most moment





在 valdis.kletnieks@xxxxxx,2017年12月9日 16:20写道:

On Sat, 09 Dec 2017 11:04:09 +0330, alireza sanaee said:

> I think if it works in that way, it doesn't make sense at all!!!! Parent
> and child ordering rules should preserve even on different cores!

Find where in kernel/sched.c there's specific code to guarantee that
if the child/parent is started on one core, the other isn't scheduled again
until after the first one runs, rather than run immediately because it's
able to run on an otherwise idle core, so you don't get a 'first' or
'last', but 'at the same time'.

And if they run concurrently, the printf output will have a race
condition.  At that point, the order of output is probably determined
by something other than which one scheduled first (the I/O stack
or exit() processing being the primary suspects).

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux