Re: [RFC PATCH] mutex: Apply adaptive spinning on mutex_trylock()
From: Andrey Kuzmin <hidden>
Date: 2011-03-23 19:47:19
Also in:
lkml
On Wed, Mar 23, 2011 at 6:48 PM, Linus Torvalds [off-list ref] wrote:
On Wed, Mar 23, 2011 at 8:37 AM, Tejun Heo [off-list ref] wrote:quoted
Currently, mutex_trylock() doesn't use adaptive spinning. =C2=A0It t=
ries
quoted
just once. =C2=A0I got curious whether using adaptive spinning on mutex_trylock() would be beneficial and it seems so, at least for btrfs anyway.Hmm. Seems reasonable to me.
TAS/spin with exponential back-off has been preferred locking approach in Postgres (and I believe other DBMSes) for years, at least since '04 when I had last touched Postgres code. Even with 'false negative' cost in user-space being much higher than in the kernel, it's still just a question of scale (no wonder measurable improvement here is reported from dbench on SSD capable of few dozen thousand IOPS). Regards, Andrey
The patch looks clean, although part of that is just the mutex_spin() cleanup that is independent of actually using it in trylock. So no objections from me. =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
Linus
-- To unsubscribe from this list: send the line "unsubscribe linux-btrfs=
" in
the body of a message to majordomo@vger.kernel.org More majordomo info at =C2=A0http://vger.kernel.org/majordomo-info.ht=
ml