Re: [PATCH] 2.4.18-pre9, trylock for read/write semaphores

From: David Howells (dhowells@redhat.com)
Date: Wed Feb 13 2002 - 02:47:32 EST


> > + new = old + RWSEM_ACTIVE_READ_BIAS;
> > + if (cmpxchg(&sem->count, old, new) == old)
> > + return 1;
>
> cmpxchg isnt present on i386

This isn't actually relevant... <asm/rwsem.h> isn't actually used unless
CONFIG_RWSEM_GENERIC_SPINLOCK is turned off, which it isn't if the CPU type is
configured to "i386":

        [arch/i386/config.in]
        if [ "$CONFIG_M386" = "y" ]; then
           define_bool CONFIG_X86_CMPXCHG n
           define_bool CONFIG_X86_XADD n
           define_int CONFIG_X86_L1_CACHE_SHIFT 4
           define_bool CONFIG_RWSEM_GENERIC_SPINLOCK y
           define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n
        else
           define_bool CONFIG_X86_WP_WORKS_OK y
           define_bool CONFIG_X86_INVLPG y
           define_bool CONFIG_X86_CMPXCHG y
           define_bool CONFIG_X86_XADD y
           define_bool CONFIG_X86_BSWAP y
           define_bool CONFIG_X86_POPAD_OK y
           define_bool CONFIG_RWSEM_GENERIC_SPINLOCK n
           define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM y
        fi

        [include/linux/rwsem.h]
        #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
        #include <linux/rwsem-spinlock.h> /* use a generic implementation */
        #else
        #include <asm/rwsem.h> /* use an arch-specific implementation */
        #endif

David
-
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/



This archive was generated by hypermail 2b29 : Fri Feb 15 2002 - 21:00:52 EST