mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Zhenghui Hao <zhenghui.hao@qq.com>,
	akpm@linux-foundation.org, ziy@nvidia.com
Cc: vbabka@kernel.org, surenb@google.com, mhocko@suse.com,
	brendan.jackman@linux.dev, hannes@cmpxchg.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page_alloc: release isolated freepages on compound range mismatch
Date: Mon, 2 Nov 2026 11:10:16 +0100	[thread overview]
Message-ID: <bd519d0f-9e00-4efe-a090-9ce81bd4ccfc@kernel.org> (raw)
In-Reply-To: <tencent_9125D3B8701AD20B318ED534FC1119659807@qq.com>

On 11/2/26 10:29, Zhenghui Hao wrote:
> 
> On 2026/11/2 17:11, David Hildenbrand (Arm) wrote:
>> On 11/2/26 10:06, Zhenghui Hao wrote:
>>> alloc_contig_frozen_range_noprof() isolates [outer_start, outer_end)
>>> before checking whether a __GFP_COMP request exactly matches the
>>> allocated range.  If it does not, the function returns -EINVAL without
>>> releasing cc.freepages, leaking the isolated pages.
>>>
>>> Call release_free_list() before returning -EINVAL, while the pageblock
>>> is still isolated, matching the cleanup already used when
>>> isolate_freepages_range() fails.
>>>
>>> Use WARN_ONCE() as well: the condition is reachable through the exported
>>> API, and repeated invalid calls should not flood dmesg.
>>>
>>> Tested with an order-9 free pageblock and a one-page __GFP_COMP
>>> subrange:
>>>   before: free_buddy=0, leaked=512/512
>>>   after:  free_buddy=1, leaked=0/512
>> How did you reproduce this? Using a hacky kernel module?
>>
>>> Fixes: e98337d11bbdf ("mm/contig_alloc: support __GFP_COMP")
>> I thought we discussed this in the past: if you are able to trigger the WARN
>> something is messed up already.
>>
>>
>> And indeed, same patch already here, SMH
>>
>> https://lore.kernel.org/linux-mm/20260629-free-pfn-on-alloc-contig-range-error-path-v1-1-496ff9ca22db@nvidia.com/
> Thanks for the pointer, and sorry for the duplicate -- I missed the
> earlier thread.
> 
> You're right on both points: the reproducer was a synthetic module, not a
> real workload, and being able to trigger the WARN means the underlying
> path or validation needs fixing rather than papering over it with
> WARN_ONCE.
> 
> I'll drop this version and follow the existing thread. I'll check whether
> the earlier patch is still pending and only send an update if there is a
> real delta on the current tree.

@Zi, are you still intending to follow up on the things we discussed in that thread?

-- 
Cheers,

David

  reply	other threads:[~2026-11-02 10:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  9:06 Zhenghui Hao
2026-11-02  9:11 ` David Hildenbrand (Arm)
2026-11-02  9:29   ` Zhenghui Hao
2026-11-02 10:10     ` David Hildenbrand (Arm) [this message]
2026-11-02 14:30       ` Zi Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd519d0f-9e00-4efe-a090-9ce81bd4ccfc@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=brendan.jackman@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=zhenghui.hao@qq.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®