Re: +atomic-improve-atomic_inc_unless_negative-atomic_dec_unless_positive .patchadded to -mm tree
From: Eric Dumazet
Date: Thu Mar 21 2013 - 14:03:53 EST
On Thu, 2013-03-21 at 18:08 +0100, Oleg Nesterov wrote:
> OK... since nobody volunteered to make a patch, what do you think about
> the change below?
> It should "fix" atomic_add_unless() (only on x86) and optimize
> With this change atomic_*_unless() can do the unnecessary mb() after
> cmpxchg() fails, but I think this case is very unlikely.
> And, in the likely case atomic_inc/dec_unless avoids the 1st cmpxchg()
> which in most cases just reads the memory for the next cmpxchg().
Hmm, cmpxchg() has different effect on MESI transaction, than a plain
Given there is a single user of atomic_inc_unless_negative(),
(get_write_access(struct inode *inode) )
maybe the 'hint' idea used in atomic_inc_not_zero_hint() could be used.
(The caller might know what is the expected current value, instead of
using atomic_read() and possibly not use appropriate transaction)
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/