From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0A5D2F361F for ; Thu, 14 May 2026 14:16:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778768182; cv=none; b=t0iClBStWKjtkjnSNdJkbPvBCPpEBG3v3GWNjvNA2doo4IOpdDvrwTLocxCcf/YyRCScr1BW9g89YbBIVobNlkN86xBBtuAgCfTh1qX5yqCF3bHZaeenm9nnUfg2QBn+6ZJ+du4rq2Q1owWd3PcpIocAVAfY9HXvsKXB4d/fkAM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778768182; c=relaxed/simple; bh=7LY9rfL74rDmyNKIONUHS+WulH4uKCOzdJH8u/psLT8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XyID2aVPY6J25qIGAyb7lqm7gN6EQVXk9mAvKq9ZOUHZ2buaeMmAdFhmNSOrS19PK/zhctlryE6khCMMqAhR+lheYdUlL0MwsuVXKhKuudnbYnG1e9yYLMfgp496aZDEh12QTHe+SlIyXa+KO5R+jqvIeEGgMPl9I+fHF9JrvRo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=IXrM+4bn; arc=none smtp.client-ip=209.85.167.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="IXrM+4bn" Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-464bba3a9easo4326389b6e.0 for ; Thu, 14 May 2026 07:16:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1778768177; x=1779372977; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=D/aRcyReAB/yBt5Ujgx4hlVRsrvunB+iUEF0sUUUSTA=; b=IXrM+4bn/okTu99mzIZDAB4TlsG5ooArJWmKrN5nPgOVkDDlV7qTgMXzutlLswiRGH oJFbvsaC0gcxyH7yEMwa7kie6rRNiK9XHfE6GUqMq5VVo7UVy+/iZ6caz2POTNpzSSxU yBomM5G/+g6JH7HakD9qcgV88v7EPAOeTIiOjDglx5Qd6kqlXVFKPWkMzEvIbJZ9EfIw DyhRK0I+MhHbLdMCuMX7qauUUTV6bMZuYt7NLbvataM1wFP4m6ejtwppiWaAL6qBdcds iXQsHAiefORGXFp7ZBYvrdlrkB7OIlzzWLyDxW7+AMJMs3HHIK36XgKY//7TLC8TEpI/ QQAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778768177; x=1779372977; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D/aRcyReAB/yBt5Ujgx4hlVRsrvunB+iUEF0sUUUSTA=; b=g15A0rsSsCE7OP53HT3XRqi0Ew8OzYj1wKCkA665XjqqttFZLf/F8OgtnRJjQ78VU/ QLy0M4xgqdCySje/rmlsraK+HbAplhPRZOa+n0dVLsBhr2afQwAOve/PFcoVJWaRvSsH yaL26GBW1jmeESIon8q0M96FHMli7/gNBE04+ZqHtyZ9dlFI3q4Bg6pylIdFTEIeHnjb qhAe+AHo2QkMnxj/OjhX8Tu9+7aCLmQIQQnAA0oFXSNbAzK9uZUMpYaLdPw6sXj/zaQT I1b6q7LD2M6hqHv7a1o7f2kSxipWuHEBfpNxSW+i6LBKZAe8VbePcvx6HnO1/+KbU19p rysw== X-Gm-Message-State: AOJu0YxYbuWJoXodIa2C9GfVZe5QTebJlTG4SEUpCsJkjsPq2Wjv2RbS r5oLe0xpSrhYqvK5YD0LY0NzBYk/wimhE81SQbvCtSa/OkCVXlpIcfVAS/GlRrQq46aO2Hej17F 1I+eI X-Gm-Gg: Acq92OGL3QgY/8jL2RSmQf28kGaFyZN1zKYrUhSBXtpdkKdApLXIvm30AzkHw7xXuxm Q0jXAWcW4znME9cEKYedXJJvkhYnROSgosgJEcQr1LjDr84/+XEnVa0yzT6D3lsCAk7XvxEujtf wwP/0ZD0jjv0szl4oCsUdnoAHe14UYXyN/P7n0bYGBDXk2LFztK7koJkrON9jDBmaQaiexsnRs6 53wXy3hPl5E0h+KYt7Pk3VQRXhxdV/DzmvPbNe1vpOrMe0iXKCxpeyOjoAy420dCc+U951N03pr o+SCEc8CsqWQWix80sEEc5ehDRysN0xnTtpiDMeCYvlldftsIYYG8u9BprqA4lzwBJRrBO1xpVa PqydoCB6WcNfHnbWok/AQlxILHjoUwtwXzfATuXDsx777Dx7Wyh+/za8LxPbInmaJCfCrBxuEv2 Z/TjS0CijAZXzSQ/Q9T3OCDpc1YRNGI8u9vqsuJaocSpLEqmNsQ0LL1w9F4B0xhotgCFrr6nR+6 XuHxg+igJYXhnwOhdOJOco= X-Received: by 2002:a05:6214:4291:b0:8ae:6460:c544 with SMTP id 6a1803df08f44-8c7bc05a2b9mr122449846d6.41.1778768157667; Thu, 14 May 2026 07:15:57 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-100-36-248-188.washdc.fios.verizon.net. [100.36.248.188]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8c90c359c74sm24280456d6.45.2026.05.14.07.15.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 07:15:57 -0700 (PDT) Date: Thu, 14 May 2026 10:15:55 -0400 From: Gregory Price To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, "David Hildenbrand (Arm)" , Jason Wang , Xuan Zhuo , Eugenio =?iso-8859-1?Q?P=E9rez?= , Muchun Song , Oscar Salvador , Andrew Morton , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Hugh Dickins , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Ying Huang , Alistair Popple , Christoph Lameter , David Rientjes , Roman Gushchin , Harry Yoo , Axel Rasmussen , Yuanchu Xie , Wei Xu , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , virtualization@lists.linux.dev, linux-mm@kvack.org, Andrea Arcangeli Subject: Re: [PATCH v7 22/31] mm: page_alloc: preserve PG_zeroed in page_del_and_expand Message-ID: References: <9a22e0f9bbe1278913754db6df76e291a006181a.1778616612.git.mst@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9a22e0f9bbe1278913754db6df76e291a006181a.1778616612.git.mst@redhat.com> On Tue, May 12, 2026 at 05:07:05PM -0400, Michael S. Tsirkin wrote: > Propagate PG_zeroed through buddy splits in page_del_and_expand() > and try_to_claim_block(). When a zeroed high-order page is split > to satisfy a smaller allocation, the sub-pages placed back on the > free lists keep PG_zeroed. > > Signed-off-by: Michael S. Tsirkin > Reviewed-by: Gregory Price > Assisted-by: Claude:claude-opus-4-6 > Assisted-by: cursor-agent:GPT-5.4-xhigh Already reviewed this, but noticing the same pattern - wondering if we should just snapshot all the flags and plumb it through instead of just extending functions like this to have infinite bools. > --- > mm/page_alloc.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index d70c9ba6b329..468e8bde7d34 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -1712,7 +1712,8 @@ struct page *__pageblock_pfn_to_page(unsigned long start_pfn, > * -- nyc > */ > static inline unsigned int expand(struct zone *zone, struct page *page, int low, > - int high, int migratetype, bool reported) > + int high, int migratetype, bool reported, > + bool zeroed) > { > unsigned int size = 1 << high; > unsigned int nr_added = 0; > @@ -1743,6 +1744,8 @@ static inline unsigned int expand(struct zone *zone, struct page *page, int low, > */ > if (reported) > __SetPageReported(&page[size]); > + if (zeroed) > + __SetPageZeroed(&page[size]); > } > > return nr_added; > @@ -1754,10 +1757,12 @@ static __always_inline void page_del_and_expand(struct zone *zone, > { > int nr_pages = 1 << high; > bool was_reported = page_reported(page); > + bool was_zeroed = PageZeroed(page); > > __del_page_from_free_list(page, zone, high, migratetype); > > - nr_pages -= expand(zone, page, low, high, migratetype, was_reported); > + nr_pages -= expand(zone, page, low, high, migratetype, was_reported, > + was_zeroed); > account_freepages(zone, -nr_pages, migratetype); > } > > @@ -2335,11 +2340,12 @@ try_to_claim_block(struct zone *zone, struct page *page, > if (current_order >= pageblock_order) { > unsigned int nr_added; > bool was_reported = page_reported(page); > + bool was_zeroed = PageZeroed(page); > > del_page_from_free_list(page, zone, current_order, block_type); > change_pageblock_range(page, current_order, start_type); > nr_added = expand(zone, page, order, current_order, start_type, > - was_reported); > + was_reported, was_zeroed); > account_freepages(zone, nr_added, start_type); > return page; > } > -- > MST >