Linux-kernel mailing list archive 1999-34,: Re: [patch] possible SMP races all over the place in wait_event

# Re: [patch] possible SMP races all over the place in wait_event

Andrea Arcangeli (andrea@suse.de)
Tue, 24 Aug 1999 14:45:38 +0200 (CEST)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Thomas Molina: "Re: linux-kernel-digest V1 #4344 (Was complie errors for 2.3.14)"
- Previous message: Peter Rival: "Re: tasks.h missing from 2.3.14"
- In reply to: David S. Miller: "Re: [patch] possible SMP races all over the place in wait_event interface"
- Next in thread: Ingo Molnar: "Re: [patch] possible SMP races all over the place in wait_event interface"

On Tue, 24 Aug 1999, David S. Miller wrote:

> From: Ingo Molnar <mingo@redhat.com>
>
> instead of:
>
> current->state = TASK_INTERRUPTIBLE;
> + mb();
>
> shouldnt we do:
>
> + xchgl(&current->state, TASK_INTERRUPTIBLE);
>
> This 'merges' the barrier and the write. Or rather, in asm-i386 we could
> do something like:
>
> #define set_mb(addr,val) xchgl(addr,val)
>
> and then use set_barrier().
>
>Sure, but it costs ~8 instructions instead of 2 on ll/sc architectures.

I don't know what is "ll/sc" but I agree that at least on architectures
that has a proper "mb" assembler instruction the mb() approch seems to be
right choice to me.

When we'll reach an agreement I'll be happy to redo the patch with a
different approch. ;) (after all the conversion will be only a trivial
task)

My proposal could be something like:

set_current_state(INTERRUPTIBLE);

and #define a secondary:

__set_current_state(INTERRUPTIBLE);

that it will never used by me, but it can be used to implement future code
that doesn't need an explicit SMP memory barrier.

Hints are welcome. ;)

Thanks.

Andrea

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

- Next message: Thomas Molina: "Re: linux-kernel-digest V1 #4344 (Was complie errors for 2.3.14)"
- Previous message: Peter Rival: "Re: tasks.h missing from 2.3.14"
- In reply to: David S. Miller: "Re: [patch] possible SMP races all over the place in wait_event interface"
- Next in thread: Ingo Molnar: "Re: [patch] possible SMP races all over the place in wait_event interface"