Re: [PATCH] mm/kasan: make quarantine_lock a raw_spinlock_t

From: Andrew Morton
Date: Fri Oct 12 2018 - 19:57:01 EST


On Wed, 10 Oct 2018 23:49:45 +0200 Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> wrote:

> On 2018-10-10 11:57:41 [+0200], Dmitry Vyukov wrote:
> > Yes. Clark's patch looks good to me. Probably would be useful to add a
> > comment as to why raw spinlock is used (otherwise somebody may
> > refactor it back later).
>
> If you really insist, I could add something but this didn't happen so
> far. git's changelog should provide enough information why to why it was
> changed.

Requiring code readers to look up changelogs in git is rather user-hostile.
There are several reasons for using raw_*, so an explanatory comment at
each site is called for.

However it would be smarter to stop "using raw_* for several reasons".
Instead, create a differently named variant for each such reason. ie, do

/*
* Nice comment goes here. It explains all the possible reasons why -rt
* might use a raw_spin_lock when a spin_lock could otherwise be used.
*/
#define raw_spin_lock_for_rt raw_spinlock

Then use raw_spin_lock_for_rt() at all such sites.