lkml.org 
[lkml]   [2000]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch-2.4.0-test12-pre5] optimized get_empty_filp()
On Tue, 5 Dec 2000, Peter Samuelson wrote:
> [Tigran Aivazian]
> > The only reason one could think of was to "hold the lock for as short
> > time as possible" but a minute's thought reveals that such reason is
> > invalid (i.e. one is more likely to waste time spinning on the lock
> > than to save it by dropping/retaking it, given the relative duration
> > of the instructions we execute there without the lock).
>
> If there is no contention, you do not spin, no time wasted

wrong -- time is wasted -- 1 decb for lock and 1 movb for unlock. No time
is wasted on spinning but 2 instructions wasted for taking/dropping the
lock.

>
> If there *is* contention, you deserialize the routine just a little
> bit, which is generally a Good Thing.
>
> Whether a memset of 92 bytes (on 32-bit arch), plus an atomic_set(),
> are worth deserializing, I do not know.
>

Of course, they are worth it. Actually, I don't understand how can you
even doubt it? Even a single cycle of code executed for _no reason_ must
be removed, if for no other reason than to make the code easier to
understand and prevent people from asking questions like "why does X do Y
for no reason?" -- if there are no such items "Y" then the questions will
also cease.

Regards,
Tigran

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:51    [W:0.078 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site