Re: kmalloc in the schedule function

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

 



Hi all,
You shouldn't call a function that might sleep (such as kmalloc())
from schedule().
You may get away with it if you use GFP_ATOMIC or similar, but still
it sounds like a really bad idea.

Why do you think you need to call kmalloc() from schedule anyway?

If someone wants to analyse or track how the processes are scheduled under SMP machine, a possible way is to use relayfs to report log information. For logging purposes sometimes is wothwhile to create a struct that represents your log data.

Basically the malloc should be performed in schedule() function or in the sched_info_switch() function called by schedule() as:

my_data = (struct log *)kmalloc(sizeof(struct log), GFP_ATOMIC);

But even using the GFP_ATOMIC does not work in sched_info_switch().

Are there any difference to use kmalloc() in schedule() or schedule_info_switch() ?

BR,

Mauricio Lin.


Yahoo! Search
Dê uma espiadinha e saiba tudo sobre o Big Brother Brasil.

[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