The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Oscar Salvador (SUSE)" <osalvador@kernel.org>
To: Usama Arif <usama.arif@linux.dev>
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, muchun.song@linux.dev
Subject: Re: [PATCH] mm/cma: fix reserved page leak on activation failure
Date: Tue, 26 May 2026 13:51:15 +0200	[thread overview]
Message-ID: <ahWJMwG8xoQli_Q0@localhost.localdomain> (raw)
In-Reply-To: <20260526113005.3610737-1-usama.arif@linux.dev>

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, 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

  reply	other threads:[~2026-05-26 11:51 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) [this message]
2026-05-26 12:44     ` Muchun Song
2026-05-26 12:59       ` Usama Arif

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=ahWJMwG8xoQli_Q0@localhost.localdomain \
    --to=osalvador@kernel.org \
    --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=rppt@kernel.org \
    --cc=songmuchun@bytedance.com \
    --cc=stable@vger.kernel.org \
    --cc=surenb@google.com \
    --cc=usama.arif@linux.dev \
    --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