Re: [PATCH] Fixes for RCU handling of task_struct

From: Paul E. McKenney
Date: Mon Nov 07 2005 - 13:10:17 EST


On Mon, Nov 07, 2005 at 04:51:26PM +1100, Nick Piggin wrote:
> Paul E. McKenney wrote:
> >On Mon, Nov 07, 2005 at 12:12:25PM +1100, Nick Piggin wrote:
>
> >>Yes, it is basically ready to go.
> >
> >Would it simplify the rcuref.h code? Or lib/dec_and_lock.c?
>
> Yep, I recently posted it to lkml... rcuref.h disappears, and
> dec_and_lock becomes simplified not to mention more efficient
> on those architectures which do not define HAVE_ARCH_CMPXCHG.
>
> http://marc.theaimsgroup.com/?l=linux-kernel&m=113117753625350&w=2
> http://marc.theaimsgroup.com/?l=linux-kernel&m=113117753629218&w=2
>
> I need the infrastructure for lockless pagecache, but fortunately
> it is very useful for other things as well. Especially lockless
> algorithms it seems.

I have been inconvenienced by lack of cmpxchg across all architectures
a number of times -- one can often work around it, but...

Here are the places that check __HAVE_ARCH_CMPXCHG in 2.6.14:

o arch/i386/kernel/acpi/boot.c <global> 85 #ifndef __HAVE_ARCH_CMPXCHG

Warning message saying that ACPI must use 486 or later.
Should be able to get rid of this, though not sure what you
have to do to ACPI.

o include/asm-i386/mc146818rtc.h <global> 16 #ifdef __HAVE_ARCH_CMPXCHG

Provides __cmpxchg()-based code for 486 and better, and assumes
that 386 is UP. Should be able to eliminate the 386 code and
the #ifdef.

o include/linux/rcuref.h <global> 47 #ifdef __HAVE_ARCH_CMPXCHG
o kernel/rcupdate.c <global> 76 #ifndef __HAVE_ARCH_CMPXCHG
o lib/dec_and_lock.c <global> 6 #ifdef __HAVE_ARCH_CMPXCHG

Looks like you have these three covered.

There are about 50 uses of cmpxchg, and it is possible that some of them
would be simplified by your primitives, as well.

So having cmpxchg available would be a very good thing!

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