[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aOCaLNKZcC37w7ok@MiWiFi-R3L-srv>
Date: Sat, 4 Oct 2025 11:53:16 +0800
From: Baoquan He <bhe@...hat.com>
To: "Uladzislau Rezki (Sony)" <urezki@...il.com>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, Michal Hocko <mhocko@...e.com>
Subject: Re: [PATCH v3 08/10] mm: Skip might_alloc() warnings when
PF_MEMALLOC is set
On 10/01/25 at 09:26pm, Uladzislau Rezki (Sony) wrote:
> might_alloc() catches invalid blocking allocations in contexts
> where sleeping is not allowed.
>
> However when PF_MEMALLOC is set, the page allocator already skips
> reclaim and other blocking paths. In such cases, a blocking gfp_mask
> does not actually lead to blocking, so triggering might_alloc() splats
> is misleading.
>
> Adjust might_alloc() to skip warnings when the current task has
> PF_MEMALLOC set, matching the allocator's actual blocking behaviour.
>
> Acked-by: Michal Hocko <mhocko@...e.com>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@...il.com>
> ---
> include/linux/sched/mm.h | 3 +++
> 1 file changed, 3 insertions(+)
Reviewed-by: Baoquan He <bhe@...hat.com>
>
> diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
> index 0232d983b715..a74582aed747 100644
> --- a/include/linux/sched/mm.h
> +++ b/include/linux/sched/mm.h
> @@ -318,6 +318,9 @@ static inline void might_alloc(gfp_t gfp_mask)
> fs_reclaim_acquire(gfp_mask);
> fs_reclaim_release(gfp_mask);
>
> + if (current->flags & PF_MEMALLOC)
> + return;
> +
> might_sleep_if(gfpflags_allow_blocking(gfp_mask));
> }
>
> --
> 2.47.3
>
Powered by blists - more mailing lists