From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8EFA472784 for ; Mon, 11 May 2026 18:29:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778524153; cv=none; b=TiRduf9xLtjhd/fqmpLncKuPzlukNp7CMHM77Ju87RxadFynpXCR8DSCVzeaoPGDPJJN+8J/HNZ5jCuHHD1bpMoX0xKqr9fahBI3Yr6PN9mTrlgpYL6sw6R9IfVZDtVP3eokaxSw2nVU6ByxAzL4cGRXLYqyRPrFkVooORsWuX0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778524153; c=relaxed/simple; bh=dD5KsBVjOKzbuuocy0Of5v+EieSuaBTX5iQxL9kS8G8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Q9HBwuo6UeYFQHq35rIMxV6SfGDjYEL5X6nZNjxnaS2NBl2SVAZDMk4drJX+HhNB5X1iycHQIGM7UBQwHcaAz1+a/vVtqGEO823G8JCtXimpZVKzKNK17id2Htb0LPseXOsfSePvkU8v4pGPLlCY2gGi/9bFewDSLlAZmR71gBk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jb3mppHT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jb3mppHT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AFB1C2BCB0; Mon, 11 May 2026 18:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778524153; bh=dD5KsBVjOKzbuuocy0Of5v+EieSuaBTX5iQxL9kS8G8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=jb3mppHT0Pe7eR2WirODoxeKgLV4AZ+3ltjcUtPzexErSUkDw+gyugg33m5BjBhUX a859N2vM5ue9HGJy8w9ho901SEzgYAR1OLTuMZ7H7+pMBtbIt6YGpykir+xd5iv54Y wSw1bQs6rADUKPHUDxYIxK6rQ8777Z3AwH4ZL0pZxhtYDvJ018k3aIf6U7DOmraqs2 CyIsqNzWm5CqfRG4Qjpzv7wh5KGEV7IgMChIUPY/fKyCtjV/D1jrgZuO+7h9o7Qcx+ S2rihlTGMS/tpNT3K4zUIPRPZIVrWexcd2DBOZvv9J1OVEEW0p57az7KmgGg4phGpU HV4YtVYPl1//w== Message-ID: Date: Mon, 11 May 2026 20:29:04 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 14/22] mm: encode freetype flags in pageblock flags Content-Language: en-US To: Brendan Jackman , Borislav Petkov , Dave Hansen , Peter Zijlstra , Andrew Morton , David Hildenbrand , Wei Xu , Johannes Weiner , Zi Yan , Lorenzo Stoakes Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, x86@kernel.org, rppt@kernel.org, Sumit Garg , derkling@google.com, reijiw@google.com, Will Deacon , rientjes@google.com, "Kalyazin, Nikita" , patrick.roy@linux.dev, "Itazuri, Takahiro" , Andy Lutomirski , David Kaplan , Thomas Gleixner , Yosry Ahmed References: <20260320-page_alloc-unmapped-v2-0-28bf1bd54f41@google.com> <20260320-page_alloc-unmapped-v2-14-28bf1bd54f41@google.com> From: "Vlastimil Babka (SUSE)" In-Reply-To: <20260320-page_alloc-unmapped-v2-14-28bf1bd54f41@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/20/26 19:23, Brendan Jackman wrote: > In preparation for implementing allocation from FREETYPE_UNMAPPED lists. > > Since it works nicely with the existing allocator logic, and also offers > a simple way to amortize TLB flushing costs, __GFP_UNMAPPED will be > implemented by changing mappings at pageblock granularity. Therefore, > encode the mapping state in the pageblock flags. > > Also add the necessary logic to record this from a freetype, and > reconstruct a freetype from the pageblock flags. > > Signed-off-by: Brendan Jackman Acked-by: Vlastimil Babka (SUSE) nit: > @@ -434,9 +431,20 @@ __always_inline freetype_t > __get_pfnblock_freetype(const struct page *page, unsigned long pfn, > bool ignore_iso) > { > - int mt = get_pfnblock_migratetype(page, pfn); > + unsigned long mask = PAGEBLOCK_FREETYPE_MASK; > + enum migratetype migratetype; > + unsigned int ft_flags; > + unsigned long flags; > > - return migrate_to_freetype(mt, 0); > + flags = __get_pfnblock_flags_mask(page, pfn, mask); > + ft_flags = (flags & PAGEBLOCK_FREETYPE_FLAGS_MASK) >> PB_freetype_flags; > + > + migratetype = flags & PAGEBLOCK_MIGRATETYPE_MASK; > +#ifdef CONFIG_MEMORY_ISOLATION > + if (!ignore_iso && flags & BIT(PB_migrate_isolate)) (flags & BIT(PB_migrate_isolate)) ? > + migratetype = MIGRATE_ISOLATE; > +#endif > + return migrate_to_freetype(migratetype, ft_flags); > } > > /** > @@ -570,6 +578,15 @@ static void set_pageblock_migratetype(struct page *page, > PAGEBLOCK_MIGRATETYPE_MASK | PAGEBLOCK_ISO_MASK); > } > > +static inline void set_pageblock_freetype_flags(struct page *page, > + unsigned int ft_flags) > +{ > + unsigned int flags = ft_flags << PB_freetype_flags; > + > + __set_pfnblock_flags_mask(page, page_to_pfn(page), flags, > + PAGEBLOCK_FREETYPE_FLAGS_MASK); > +} > + > void __meminit init_pageblock_migratetype(struct page *page, > enum migratetype migratetype, > bool isolate) > @@ -593,7 +610,7 @@ void __meminit init_pageblock_migratetype(struct page *page, > flags |= BIT(PB_migrate_isolate); > #endif > __set_pfnblock_flags_mask(page, page_to_pfn(page), flags, > - PAGEBLOCK_MIGRATETYPE_MASK | PAGEBLOCK_ISO_MASK); > + PAGEBLOCK_FREETYPE_MASK); > } > > #ifdef CONFIG_DEBUG_VM >