schedule()

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

 



Hi!

to begin my quest in kernel hacking, i decided it would be wise to first read 
some of the existing source, to get a feel for how things operate (famous last 
words :^).  the oom_kill.c in kernel/ is nice to read, as are some others.

however, sched.c doesn't seem so nice =)   in many of the functions, there are 
goto's with no apparent reason, especially in schedule() itself  (look at 
move_rr_last/back and in_interrupt).  is there a reason for this?  i have yet 
to look at the gcc -save-temps output to see if its some kind of optimization 
or some form of code obscurity.  I would imagine gcc would replace a goto with 
a jmp (on x86 at least) in almost all cases, unless its smarter than that.

some parts are clearly a loop of some sort, but others, as mentioned above, 
exist with only one calling goto present, and their return is either a return 
from schedule() or a goto back to right after the goto.

would replacing some of the goto insanity with plain linear code improve 
performance any (negligible most likly, but a little at least)?

some functions are inlines, with a few goto out's inside.. this may have to do 
with aligning code when it's inlined (no jump to get to the end of the inlined 
function chunk).  schedule() isnt inline though.

the source im reading/using is 2.4.14, im not sure if it changes that much, so 
it may be different already.

thanks =)
chris

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[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