lkml.org 
[lkml]   [2005]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/19] MUTEX: Introduce simple mutex implementation
From
Date
On Tue, 2005-12-13 at 08:54 +0100, Ingo Molnar wrote:
> * Andrew Morton <akpm@osdl.org> wrote:
>
> > I'd have thought that the way to do this is to simply reimplement
> > down(), up(), down_trylock(), etc using the new xchg-based code and to
> > then hunt down those few parts of the kernel which actually use the
> > old semaphore's counting feature and convert them to use down_sem(),
> > up_sem(), etc. And rename all the old semaphore code:
> > s/down/down_sem/etc.
>
> even better than that, why not use the solution that we've implemented
> for the -rt patchset, more than a year ago?
>
> the solution i took was this:
>
> - i did not touch the 'struct semaphore' namespace, but introduced a
> 'struct compat_semaphore'.

which I think is wrong. THis naming sucks. Sure doing a full sed on the
tree is not pretty but it's also not THAT painful. And the pain of wrong
names is something the kernel needs to carry around for years.
>
> - i introduced a 'type-sensitive' macro wrapper that switches down()
> (and the other APIs) to either to the assembly variant (if the
> variable's type is struct compat_semaphore), or switches it to the new
> generic mutex (if the type is struct semaphore), at build-time. There
> is no runtime overhead due to this build-time-switching.

while this is a smart trick, I rather prefer seperate functions, just so
that people are "aware" which they use. Since 99% of the users is a
mutex anyway, the new names are only used in a few special cases.


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

\
 
 \ /
  Last update: 2005-12-13 09:02    [W:0.215 / U:0.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site