[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZAnvqKtZdaD7FsdT@kernel.org>
Date: Thu, 9 Mar 2023 16:39:36 +0200
From: Mike Rapoport <rppt@...nel.org>
To: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
Cc: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"peterz@...radead.org" <peterz@...radead.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"song@...nel.org" <song@...nel.org>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"vbabka@...e.cz" <vbabka@...e.cz>,
"x86@...nel.org" <x86@...nel.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Subject: Re: [RFC PATCH 1/5] mm: intorduce __GFP_UNMAPPED and unmapped_alloc()
On Thu, Mar 09, 2023 at 01:56:37AM +0000, Edgecombe, Rick P wrote:
> On Wed, 2023-03-08 at 11:41 +0200, Mike Rapoport wrote:
> > +
> > +static inline void __free_one_page(struct page *page, unsigned int
> > order,
> > + bool cache_refill)
> > +{
> > + unsigned long pfn = page_to_pfn(page);
> > + unsigned long buddy_pfn;
> > + unsigned long combined_pfn;
> > + struct page *buddy;
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(&free_area->lock, flags);
> > +
> > + if (cache_refill) {
> > + set_pageblock_unmapped(page);
> > + free_area[order].nr_cached++;
> > + }
> > +
> > + while (order < MAX_ORDER - 1) {
> > + buddy = find_unmapped_buddy_page_pfn(page, pfn,
> > order,
> > + &buddy_pfn);
> > + if (!buddy)
> > + break;
> > +
> > + del_page_from_free_list(buddy, order);
> > + combined_pfn = buddy_pfn & pfn;
> > + page = page + (combined_pfn - pfn);
> > + pfn = combined_pfn;
> > + order++;
> > + }
> > +
> > + set_unmapped_order(page, order);
> > + add_to_free_list(page, order);
> > + spin_unlock_irqrestore(&free_area->lock, flags);
> > +}
> > +
>
> The page has to be zeroed before it goes back on the list, right? I
> didn't see it.
You are right, I missed it.
--
Sincerely yours,
Mike.
Powered by blists - more mailing lists