[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1372109438.22432.75.camel@schen9-DESK>
Date: Mon, 24 Jun 2013 14:30:38 -0700
From: Tim Chen <tim.c.chen@...ux.intel.com>
To: Peter Hurley <peter@...leysoftware.com>
Cc: Davidlohr Bueso <davidlohr.bueso@...com>,
Alex Shi <alex.shi@...el.com>,
Michel Lespinasse <walken@...gle.com>,
Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Andi Kleen <andi@...stfloor.org>,
Matthew R Wilcox <matthew.r.wilcox@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Rik van Riel <riel@...hat.com>, linux-kernel@...r.kernel.org,
linux-mm <linux-mm@...ck.org>
Subject: Re: [PATCH 2/2] rwsem: do optimistic spinning for writer lock
acquisition
On Mon, 2013-06-24 at 16:48 -0400, Peter Hurley wrote:
>
> Also, I haven't given a lot of thought to if preemption must be disabled
> before calling rwsem_can_spin_on_owner(). If so, wouldn't you just drop
> rwsem_can_spin_on_owner() (because the conditions tested in the loop are
> equivalent)?
>
Not totally equivalent. If we drop the call to rwsem_can_spin_on_owner,
we will spin when readers are holding the lock (owner is null).
Right now we only allow writers to spin when other writers are
holding the lock by adding the rwsem_can_spin_on_owner check.
Letting spinning on readers held lock is tricky as
we could have a reader that sleeps and if we don't detect the case. We
could spin for too long.
Thanks.
Tim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists