[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <153808275043.724.15980761008814866300@pink.alxu.ca>
Date: Thu, 27 Sep 2018 21:12:30 +0000
From: Alex Xu <alex_y_xu@...oo.ca>
To: Dan Streetman <ddstreet@...e.org>
Cc: Linux-MM <linux-mm@...ck.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: fix z3fold warnings on CONFIG_SMP=n
Quoting Dan Streetman (2018-09-27 20:41:21)
> On Thu, Sep 27, 2018 at 4:27 PM Alex Xu (Hello71) <alex_y_xu@...oo.ca> wrote:
> >
> > Spinlocks are always lockable on UP systems, even if they were just
> > locked.
>
> i think it would be much better to just use either
> assert_spin_locked() or just spin_is_locked(), instead of an #ifdef.
>
I wrote a longer response and then learned about the WARN_ON_SMP macro,
so I'll just use that instead.
Original response below:
I thought about using assert_spin_locked, but I wanted to keep the
existing behavior, and it seems to make sense to try to lock the page if
we forgot to lock it earlier? Maybe not though; I don't understand this
code completely. I did write a version of z3fold_page_ensure_locked with
"if (assert_spin_locked(...))" but not only did that look even worse, it
doesn't even work, because assert_spin_locked is a statement on UP
systems, not an expression. It might be worth adding a
ensure_spin_locked function that does that though...
spin_is_locked currently still always returns 0 "on CONFIG_SMP=n builds
with CONFIG_DEBUG_SPINLOCK=n", so that would just return us to the same
problem of checking CONFIG_SMP.
Powered by blists - more mailing lists