[lkml]   [2010]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 04/12] rwsem: consistently use adjustment variable
Michel Lespinasse <> wrote:

> Cleanup: previous change introduced an adjustment variable used in
> waking writers; the code to wake readers can be made nicer by making
> use of that same variable.
> Reducing variable count should hopefully help both humans and compilers
> looking at this function :)

Actually, no. The compiler doesn't care. With optimisation, the variable
'woken' would cease to exist after being copied to loop and added into
adjustment. What it would probably do is just relabel 'woken' internally as

From a human point of view, I would say keep woken, but use it to initialise

adjustment = woken * RWSEM_ACTIVE_READ_BIAS;

and use it to initialise 'loop':

for (loop = woken; loop > 0; loop--) {

or just ditch 'loop' and use 'woken' directly, since the number of processes
to be woken goes down as the loop iterates.

Whatever, the compiler won't care, since loop and woken will just be names for
the same value.


 \ /
  Last update: 2010-05-12 13:49    [W:0.233 / U:4.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site