[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51C8C36B.9020605@hurleysoftware.com>
Date: Mon, 24 Jun 2013 18:08:43 -0400
From: Peter Hurley <peter@...leysoftware.com>
To: Tim Chen <tim.c.chen@...ux.intel.com>
CC: 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>,
Davidlohr Bueso <davidlohr.bueso@...com>,
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 06/24/2013 05:58 PM, Tim Chen wrote:
> On Sat, 2013-06-22 at 03:57 -0400, Peter Hurley wrote:
>> Will this spin for full scheduler value on a reader-owned lock?
>>
>>> + /* wait_lock will be acquired if write_lock is obtained */
>>> + if (rwsem_try_write_lock(sem->count, true, sem)) {
>>> + ret = 1;
>>> + goto out;
>>> + }
>>> +
>>> + /*
>>> + * When there's no owner, we might have preempted between the
>> ^^^^^^^^
>>
>> Isn't pre-emption disabled?
>>
>
> Peter, on further review, this code is needed. This code guard against
> the case of this thread preempting another thread in the middle
> of setting the owner field. Disabling preemption does not prevent this
> thread from preempting others, even though others cannot preempt
> this thread.
Yep; so the "we" in the quoted comment really refers to another thread
executing down_write_xxxx().
Thanks for the clarification.
Regards,
Peter Hurley
--
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