Re: [PATCH 1/4] mm: page_alloc: __GFP_FS lockdep annotation for direct compaction
From: Vlastimil Babka (SUSE)
Date: Wed Jul 01 2026 - 09:45:15 EST
On 6/26/26 20:21, Johannes Weiner wrote:
> A subsequent patch will have some order-0 allocations participate in
> compaction under defrag_mode, to stave off extfrag events.
>
> Since this is a sprawling expansion of entry points, and compaction
> can enter filesystem paths, add lockdep annotations that catches
> __GFP_FS passing errors.
>
> Direct reclaim has had this annotation for a while, and since reclaim
> and compaction are usually used in conjunction, this is unlikely to
> unearth old bugs. It's more about future proofing and peace of mind.
>
> Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx>
> ---
> mm/page_alloc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index ee902a468c2f..cb422505c6ef 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4152,12 +4152,14 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
>
> psi_memstall_enter(&pflags);
> delayacct_compact_start();
> + fs_reclaim_acquire(gfp_mask);
> noreclaim_flag = memalloc_noreclaim_save();
>
> *compact_result = try_to_compact_pages(gfp_mask, order, alloc_flags, ac,
> prio, &page);
>
> memalloc_noreclaim_restore(noreclaim_flag);
> + fs_reclaim_release(gfp_mask);
> psi_memstall_leave(&pflags);
> delayacct_compact_end();
>