kern_synch.c

Zera William Holladay zholla1 at uic.edu
Sat Jan 29 09:13:05 PST 2005


Hi, I just started poking around the kernel code, so I don't know if my
question is even relevant.  In /usr/src/kern/kern_synch.c on line 736
there is a function called resetpriority().  On line 739 of the same file
in the same function there is an variable called interactive, which is an
int.  On line 773, interactive is used in the following way:

        interactive = p->p_interactive / 10;
        newpriority += interactive;

Since interactive is only used on lines 773 and 774 in resetpriority() and
since it is local to the function, why not replace these two lines with:

	newpriority += (p->p_interactive / 10);

and do away with the variable interactive entirely?

The reason I say that I am not sure if my question is even relevant is
because I don't know if this function is still used by the DF kernel.  I
have also seen some strange looking code that very good C programmers say
helps optmization, so I am not sure if this is an example of that kind of
code (ie 11-04 kernel thread "learning dragonfly or C...").

Thanks,
-Zera Holladay





More information about the Kernel mailing list