[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHttsrYf_SSEHwPZRqs2KGznPgC9Je3dPOft1bwZ5pYC5R0xUg@mail.gmail.com>
Date: Tue, 14 May 2019 09:31:48 +0800
From: Yuyang Du <duyuyang@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: will.deacon@....com, Ingo Molnar <mingo@...nel.org>,
Bart Van Assche <bvanassche@....org>, ming.lei@...hat.com,
Frederic Weisbecker <frederic@...nel.org>, tglx@...utronix.de,
Boqun Feng <boqun.feng@...il.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 01/17] locking/lockdep: Add lock type enum to explicitly
specify read or write locks
Thanks for review.
On Mon, 13 May 2019 at 19:45, Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Mon, May 13, 2019 at 05:11:47PM +0800, Yuyang Du wrote:
> > + * Note that we have an assumption that a lock class cannot ever be both
> > + * read and recursive-read.
>
> We have such locks in the kernel... see:
>
> kernel/qrwlock.c:queued_read_lock_slowpath()
>
> And yes, that is somewhat unfortunate, but hard to get rid of due to
> hysterical raisins.
That is ok, then LOCK_TYPE_RECURSIVE has to be 3 such that
LOCK_TYPE_RECURSIVE & LOCK_TYPE_READ != 0. I thought to do this in the
first place without assuming. Anyway, it is better to know.
And I guess in a task:
(1) read(X);
recursive_read(x); /* this is ok ? */
(2) recursive_read(x);
read(x) /* not ok ? */
Either way, very small change may need to be made.
Powered by blists - more mailing lists