On Wed, Nov 19, 2003 at 04:51:50PM -0500, Guillaume Thouvenin wrote: > I start to read linux source and I begin with oom_kill.c file. I have two > questions about the function out_of_memory() > > void out_of_memory(void) > { > static unsigned long first, last, count, lastkill; > unsigned long now, since; > > now = jiffies; > (1)-> since = now - last; > (2.1)-> last = now; > > /* > * If it's been a long time since last failure, > * we're not oom. > */ > (2.2)-> last = now; > if (since > 5*HZ) > goto reset; > > > In (1), variable "last" is used but it is not initialized. Is it an error? No. Look at the "static" and check your C book :) It'll be initialised to 0 like anything else in .bss w/o specific initialisation. > In (2.1) et (2.2), the affectation is done twice, is there any reason? I can't see one. "jiffies" itself is volatile so can change, but "now" is just a local, and this seems to be duplicate from a quick look. regards john -- Khendon's Law: If the same point is made twice by the same person, the thread is over. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/