[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <adaskxqrgsl.fsf@cisco.com>
Date: Sat, 12 Apr 2008 12:53:30 -0700
From: Roland Dreier <rdreier@...co.com>
To: Matthew Wilcox <matthew@....cx>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Oeser <ioe-lkml@...eria.de>,
Daniel Walker <dwalker@...sta.com>,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
Linus Torvalds <torvalds@...l.org>
Subject: Re: [PATCH] Replace completions with semaphores
> Arnd contacted me off-list and made the very sensible suggestion of:
>
> struct completion {
> struct semaphore sem;
> }
>
> That lets us eliminate the duplicate code since all the completion
> functions become very thin wrappers around semaphore operations.
Just make sure you don't forget the history of completions... As
Linus said long ago (http://lwn.net/2001/0802/a/lt-completions.php3):
In case anybody cares, the race was that Linux semaphores only protect the
accesses _inside_ the semaphore, while the accesses by the semaphores
themselves can "race" in the internal implementation. That helps make an
efficient implementation, but it means that the race was:
cpu #1 cpu #2
DECLARE_MUTEX_LOCKED(sem);
..
down(&sem); up(&sem);
return;
wake_up(&sem.wait) /*BOOM*/
--
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