Re: [PATCH]: Fix SMP-reordering race in mark_buffer_dirty

From: Linus Torvalds
Date: Wed Apr 02 2008 - 18:08:19 EST




On Wed, 2 Apr 2008, Andrew Morton wrote:
>
> But then the test-and-set of an already-set flag would newly cause the
> cacheline to be dirtied, requiring additional bus usage to write it back?
>
> The CPU's test-and-set-bit operation could of course optimise that away in
> this case. But does it?

No, afaik no current x86 uarch will optimize away the write on a locked
instuction if it turns out to be unnecessary.

Can somebody find a timing reason to have the ugly code?

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