[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aMhIv3HfRMyjlSec@tiehlicka>
Date: Mon, 15 Sep 2025 19:11:27 +0200
From: Michal Hocko <mhocko@...e.com>
To: "Uladzislau Rezki (Sony)" <urezki@...il.com>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Baoquan He <bhe@...hat.com>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 04/10] mm/vmalloc: Avoid cond_resched() when blocking
is not permitted
On Mon 15-09-25 15:40:34, Uladzislau Rezki wrote:
> vm_area_alloc_pages() contains the only voluntary reschedule points
> along vmalloc() allocation path. They are needed to ensure forward
> progress on PREEMPT_NONE kernels under contention for vmap metadata
> (e.g. alloc_vmap_area()).
>
> However, yielding should only be done if the given GFP flags allow
> blocking. This patch avoids calling cond_resched() when allocation
> context is non-blocking(GFP_ATOMIC, GFP_NOWAIT).
We do have cond_resched in the page allocator path, right?
So unless I am missing something we can safely drope these. I thought we
have discused this already.
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@...il.com>
> ---
> mm/vmalloc.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 49a0f81930a8..b77e8be75f10 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -3633,7 +3633,9 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
> pages + nr_allocated);
>
> nr_allocated += nr;
> - cond_resched();
> +
> + if (gfpflags_allow_blocking(gfp))
> + cond_resched();
>
> /*
> * If zero or pages were obtained partly,
> @@ -3675,7 +3677,9 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
> for (i = 0; i < (1U << order); i++)
> pages[nr_allocated + i] = page + i;
>
> - cond_resched();
> + if (gfpflags_allow_blocking(gfp))
> + cond_resched();
> +
> nr_allocated += 1U << order;
> }
>
> --
> 2.47.3
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists