Re: [PATCH v2] kasan: fix cache shrink race with CPU hotplug

From: Andrew Morton

Date: Sat Aug 08 2026 - 12:53:56 EST


On Sat, 8 Aug 2026 17:38:05 +0800 Hui Su <sh_def@xxxxxxx> wrote:

> Thanks Andrew,
>
> On Sat, Aug 08, 2026 at 12:39:21AM -0700, Andrew Morton wrote:
> > AI review suggests that there's a pre-existing quarantine_size
> > accounting flaw later in this function:
> >
> > https://sashiko.dev/#/patchset/20260808031459.3032812-1-sh_def@xxxxxxx
> >
> > If true, I'm surprised this hasn't yet been reported.
>
> I'll take a closer look at this. If it turns out to be a real issue,
> I'll send a separate patch since it's pre-existing and unrelated to the
> hotplug race fix.
>
> > Also, I'd like to see a need_resched() wrapping that expensive
> >
> > /* Scanning whole quarantine can take a while. */
> > raw_spin_unlock_irqrestore(&quarantine_lock, flags);
> > cond_resched();
> > raw_spin_lock_irqsave(&quarantine_lock, flags);
>
> Good point, that makes sense. Would you prefer that I fold this into a
> v3 of this patch, or send it as a separate follow-up patch?

Separate patches, please. One patch per concept.