From: Usama Arif <usama.arif@linux.dev>
To: Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@kernel.org>
Cc: Muchun Song <songmuchun@bytedance.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Frank van der Linden <fvdl@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] mm/cma: fix reserved page leak on activation failure
Date: Tue, 26 May 2026 13:59:40 +0100 [thread overview]
Message-ID: <206dc5f5-0278-4100-a595-4923da30b900@linux.dev> (raw)
In-Reply-To: <9A340644-CD8D-44B0-BBC5-43D29E9D046E@linux.dev>
On 26/05/2026 13:44, Muchun Song wrote:
>
>
>> On May 26, 2026, at 19:51, Oscar Salvador (SUSE) <osalvador@kernel.org> wrote:
>>
>> On Tue, May 26, 2026 at 04:30:03AM -0700, Usama Arif wrote:
>>> On Fri, 22 May 2026 14:26:58 +0800 Muchun Song <songmuchun@bytedance.com> wrote:
>> ...
>>>> diff --git a/mm/cma.c b/mm/cma.c
>>>> index c7ca567f4c5c..a30075507d41 100644
>>>> --- a/mm/cma.c
>>>> +++ b/mm/cma.c
>>>> @@ -188,10 +188,13 @@ static void __init cma_activate_area(struct cma *cma)
>>>>
>>>> /* Expose all pages to the buddy, they are useless for CMA. */
>>>> if (!test_bit(CMA_RESERVE_PAGES_ON_ERROR, &cma->flags)) {
>>>> - for (r = 0; r < allocrange; r++) {
>>>> + for (r = 0; r < cma->nranges; r++) {
>>>> + unsigned long start_pfn;
>>>> +
>>>> cmr = &cma->ranges[r];
>>>> + start_pfn = r < allocrange ? early_pfn[r] : cmr->early_pfn;
>>>
>>> Should this be r <= allocrange?
>
> Yes. So I sent a v2 to fix it last Saturday.
>
> https://lore.kernel.org/linux-mm/20260523060123.2207992-1-songmuchun@bytedance.com/
>
> Thanks.
Ah still catching up on the mailing list. Thanks!
>
>>
>> Yes, I think you are right. I missed that.
>>
>> early_pfn[alloc_range] holds the last assignment, so we should start
>> from the next one reading cmr->early_pfn.
>>
>>
>>
>> --
>> Oscar Salvador
>> SUSE Labs
prev parent reply other threads:[~2026-05-26 12:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 6:26 [PATCH] mm/cma: fix reserved page leak on activation failure Muchun Song
2026-05-25 17:29 ` Oscar Salvador (SUSE)
2026-05-26 11:30 ` Usama Arif
2026-05-26 11:51 ` Oscar Salvador (SUSE)
2026-05-26 12:44 ` Muchun Song
2026-05-26 12:59 ` Usama Arif [this message]
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=206dc5f5-0278-4100-a595-4923da30b900@linux.dev \
--to=usama.arif@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=fvdl@google.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=osalvador@kernel.org \
--cc=rppt@kernel.org \
--cc=songmuchun@bytedance.com \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/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