Re: sched_child_runs_first doesn't work
On Sat, Dec 9, 2017 at 11:42 PM, strongbox8 wrote: > 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 > Your explanation is right. Child process doesn't have chance to run util parent's time slice is over(Even though there's no time slice concept in CFS). From the print, it looked like parent process run first. So we need force parent and child process re-schedule before print, so that child prcess have the chance to compare "vruntime" with parent process. In this situation, we could see child process run first. I modified the test code like this, "sleep (1);" added : #include #include #include int main(void) { struct timeval tv; struct timezone tz; int err; pid_t ret = fork(); sleep(1); if (ret == 0) { err = gettimeofday(&tv, &tz); if (!err) printf("child time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec); printf("this child.\n"); } else if (ret > 1) { err = gettimeofday(&tv, &tz); if (!err) printf("father time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec); printf("this father.\n"); } else printf("err!!\n"); return 0; } Executed this app like this: # taskset 1 ./fork In the end, I could get child prcess run first sometimes. -- Cheers, Rock ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Header organization/separation rule in kernel
Hello, 11.12.2017, 00:32, "Greg KH" : > On Sun, Dec 10, 2017 at 11:21:46PM +0800, Shiyao MA wrote: >> Hi, >> >> I wonder the header separation rule in kernel. >> To make this question concrete, for example, let's targeting genetlink.h >> >> It can be found in: >> >> http://elixir.free-electrons.com/linux/latest/source/include/net/genetlink.h >> >> http://elixir.free-electrons.com/linux/latest/source/include/linux/genetlink.h >> >> http://elixir.free-electrons.com/linux/latest/source/include/uapi/linux/genetlink.h >> >> so basically three parts, in uapi, linux/genetlink.h, and net/genetlink.h. >> >> I understand the necessity of uapi, but why divide the genetlink.h in >> linux and the net folder? >> What's the benefit of such separation? hm, I think if you use a diff and you would see the why different header file. for example you development a network card driver and you not be use to linux kernel genetlink header file. use to network side genetlink.h. So please check: #ifndef __NET_GENERIC_NETLINK_H #define __NET_GENERIC_NETLINK_H #ifndef __LINUX_GENERIC_NETLINK_H #define __LINUX_GENERIC_NETLINK_H #ifndef _UAPI__LINUX_GENERIC_NETLINK_H #define _UAPI__LINUX_GENERIC_NETLINK_H they are like the assets that separate and address each others. > Some things are only for the networking subsystem, and some things are > for any other part of the kernel. > > Hope this helps, > > greg k-h Regards, Ozgur > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Header organization/separation rule in kernel
On Sun, Dec 10, 2017 at 11:21:46PM +0800, Shiyao MA wrote: > Hi, > > I wonder the header separation rule in kernel. > To make this question concrete, for example, let's targeting genetlink.h > > It can be found in: > > http://elixir.free-electrons.com/linux/latest/source/include/net/genetlink.h > http://elixir.free-electrons.com/linux/latest/source/include/linux/genetlink.h > http://elixir.free-electrons.com/linux/latest/source/include/uapi/linux/genetlink.h > > > so basically three parts, in uapi, linux/genetlink.h, and net/genetlink.h. > > I understand the necessity of uapi, but why divide the genetlink.h in > linux and the net folder? > What's the benefit of such separation? Some things are only for the networking subsystem, and some things are for any other part of the kernel. Hope this helps, greg k-h ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Header organization/separation rule in kernel
Hi, I wonder the header separation rule in kernel. To make this question concrete, for example, let's targeting genetlink.h It can be found in: http://elixir.free-electrons.com/linux/latest/source/include/net/genetlink.h http://elixir.free-electrons.com/linux/latest/source/include/linux/genetlink.h http://elixir.free-electrons.com/linux/latest/source/include/uapi/linux/genetlink.h so basically three parts, in uapi, linux/genetlink.h, and net/genetlink.h. I understand the necessity of uapi, but why divide the genetlink.h in linux and the net folder? What's the benefit of such separation? -- Best, Shiyao ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies