[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200520021738.GC16070@bombadil.infradead.org>
Date: Tue, 19 May 2020 19:17:38 -0700
From: Matthew Wilcox <willy@...radead.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Will Deacon <will@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Paul E . McKenney" <paulmck@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-mm@...ck.org
Subject: Re: [PATCH 4/8] mm/swap: Use local_lock for protection
On Tue, May 19, 2020 at 04:58:37PM -0700, Andrew Morton wrote:
> On Tue, 19 May 2020 22:19:08 +0200 Sebastian Andrzej Siewior <bigeasy@...utronix.de> wrote:
> > + local_lock(swapvec_lock);
>
> It's quite peculiar that these operations appear to be pass-by-value.
> All other locking operations are pass-by-reference - spin_lock(&lock),
> not spin_lock(lock). This is what the eye expects to see and it's
> simply more logical - calling code shouldn't have to "know" that the
> locking operations are implemented as cpp macros. And we'd be in a
> mess if someone tried to convert these to real C functions.
The funny thing is that the documentation gets this right:
+The mapping of local_lock to spinlock_t on PREEMPT_RT kernels has a few
+implications. For example, on a non-PREEMPT_RT kernel the following code
+sequence works as expected::
+
+ local_lock_irq(&local_lock);
+ raw_spin_lock(&lock);
but apparently the implementation changed without the documentation matching.
Powered by blists - more mailing lists