Re: [PATCH v2] mm/page_alloc: call check_new_pages() while zone spinlock is not held

From: Eric Dumazet
Date: Wed Mar 09 2022 - 12:32:44 EST


On Wed, Mar 9, 2022 at 4:32 AM Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> wrote:

> We should because it was an oversight. Thanks for pointing that out.
>
> > Or was it a conscious choice of yours ?
> > (I presume part of the performance gains came from
> > not having to bring ~7 cache lines per 32KB chunk on x86)
> >
>
> There will be a performance penalty due to the check but it's a correctness
> vs performance issue.
>
> This? It's boot tested only.
>
> --8<--
> mm/page_alloc: check high-order pages for corruption during PCP operations
>
> Eric Dumazet pointed out that commit 44042b449872 ("mm/page_alloc: allow
> high-order pages to be stored on the per-cpu lists") only checks the head
> page during PCP refill and allocation operations. This was an oversight
> and all pages should be checked. This will incur a small performance
> penalty but it's necessary for correctness.
>
> Fixes: 44042b449872 ("mm/page_alloc: allow high-order pages to be stored on the per-cpu lists")
> Reported-by: Eric Dumazet <edumazet@xxxxxxxxxx>
> Signed-off-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
> ---

SGTM, thanks Mel !

Acked-by: Eric Dumazet <edumazet@xxxxxxxxxx>