[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1195.1273664737@redhat.com>
Date: Wed, 12 May 2010 12:45:37 +0100
From: David Howells <dhowells@...hat.com>
To: Michel Lespinasse <walken@...gle.com>
Cc: dhowells@...hat.com,
Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Mike Waychison <mikew@...gle.com>,
Suleiman Souhlal <suleiman@...gle.com>,
Ying Han <yinghan@...gle.com>
Subject: Re: [PATCH 04/12] rwsem: consistently use adjustment variable
Michel Lespinasse <walken@...gle.com> 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
'loop'.
>From a human point of view, I would say keep woken, but use it to initialise
adjustment:
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.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists