From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 01AA33C4173 for ; Tue, 12 May 2026 15:58:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778601504; cv=none; b=tocEFpED3tcrKpsY2NiNlX6rNfAfY0VVHclXkzRDRyEkTH/AyxC9Xfn4tQbvXQX4djRg9utkHju8mnSSqZ/s5590nDHXyzIUvE9Erjc9XtHPtrlvZLf8fdi5tl9furaGeLXHRXgPLKyo0jwHNjXO6rFnKwRJClOGlFEwTTFP2U0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778601504; c=relaxed/simple; bh=NzD4h2kSUF+6CRseCSre92wX0gOpPLHk9AG9LuS8TK4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UkQqA1KZ+4PXX6E5o9Byie64tmIXRuzznHLQ/9oJukylG7pM3fyhujEb5N2mO2pF/O2x4MBRMqvG+EqXggKVrQ01tUQmvfuQD2id0OrMErxGXM/9Uk97kdYjSG9GEblZTRTH7b1THVAfsZFdIKdVUj9n4gfN7dEM17pRIj6SSOA= 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=lPZIgX5c; arc=none smtp.client-ip=209.85.222.177 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="lPZIgX5c" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-8ef45a6d9dfso608257985a.0 for ; Tue, 12 May 2026 08:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1778601501; x=1779206301; 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=fEDDU+f7CbkQFEw8YKAGo16eQTvjIgO+nLY/Z+AdBuk=; b=lPZIgX5cwiyywYAR7DEMUNrrls/JEu6V+EkN6Z4pA5Va9q90lvbOcAZ3JQMKOgl6a3 R2efVAUMcjQuN6VLxbsK595t1dDjuvqI3Rgw3yVvdX2+QGVKgmf5zIQA1n5V5OUC0MIr SCA4Xd5Ys8TwgXbg2jrrxBPCI21SC5EveU2xbZArP1YHs23OodDy7EYaBn+ZHFibBJAk +rQ/0POvm+fomT/FrCXPXoVLLX2VYfHV6uN7qdDX1qDd37+Q37IUsTPc8Y0A73kiwrLG d3MJjdi+z8eSkv3NUxUs+h34sQGdL/rsS8Jo1YqIrWFTaowawvbkLgQz4hug8FB30DAf /kYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778601501; x=1779206301; 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=fEDDU+f7CbkQFEw8YKAGo16eQTvjIgO+nLY/Z+AdBuk=; b=juQlGL9ND7pp/Ag1eRjvKKGyS5+YCkThdjJ1H/1eWOZtUZ1WyKlQ4NKfkXwhn4Xtx/ 5Fhr+Gm79iwpLzBqMbzj5zGVLqAcKCG2nZuqr3ybW58RyjJKTSOCz6T8amXj4lknXEe1 9SiW65RaZdzH1m+BdRgUfH4TqY+ioezo8rD4uOGW8a8zWoXZfcRjLzIlP0W22Sj36ZBG 3cXxY2Il22v1FEGoj1LA7olVwlM8IIBuYw5JvWywD1hzQl62UYw+gqG2sFQT/6TEqbbj ryP1k4/uGAdD/T2LB7C41KI8N9ONsmythXrFbyj8mVkyl6pww7Fq28cuTdeYekYX+O2t H3zw== X-Gm-Message-State: AOJu0Ywj+wllbtoAsovyKP1089D91yQrL7B8hFu3AwQ6KXucoBoUl2ZF ZA5K0efiswjk/z8lTyTKp13vaCB5VOxaeSr1ciDIsAaiA/q1Wdii6lGabFyiFuIbIu8= X-Gm-Gg: Acq92OHDIuWZuII1N3/jmqiTPZY6O5MZJ1I4erRJlfoolXjnVzgeyb4cnsliT9+ILGh /oJqMwJ4gDzdP6Z6N3COI2mENv7cXuieVFuBRzdNtBhW8VHU5+VqbkyLw06LnPu8zYiZoEBLfp8 U6ain3FZ5jkDz3fCGbh/8lKvBqwipPxdHDB6uA7JWfPdLGPmMeS11trUzG8Zp3Wr/tpQYGV1dmh EkNHk7fAH6WnIRANLtLWtdJ/lWH+zW7Ii4Cuth65aecm5jCCAOOhm0Xf26AZLpCG9ZSaSbZHMJN qAtUC1sFl79p5fiJrvRb3RCn/9tsmyNPrWIJMpELEmz3qePpN/rPGStM8QI6ZA4uj8omcGdzB/k 5dVOcXkeIHG4Rz12kZwonDMh1qfFM60wtZWN2Zs9t9vSUgFn+p9QjAvSGp+1HONzUmydK+Y/aZk iSTIX4uP4YKZXyj97duXTzOraOWjbntAavhvSeX+zmWMLvAqMZMFNPiu0uzXwlmvxS8xJzJcfN7 Z0NSfO0wqYK X-Received: by 2002:a05:620a:46a5:b0:8cf:d6f8:599f with SMTP id af79cd13be357-90cffa5b9a3mr483433885a.57.1778601500616; Tue, 12 May 2026 08:58:20 -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 af79cd13be357-907b8e9b24asm1421777085a.18.2026.05.12.08.58.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2026 08:58:19 -0700 (PDT) Date: Tue, 12 May 2026 11:58:17 -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 resend v6 21/30] mm: page_alloc: preserve PG_zeroed in page_del_and_expand Message-ID: References: <57d30ce615c23d3f3737e38d300f4613b3ebadbc.1778489843.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: <57d30ce615c23d3f3737e38d300f4613b3ebadbc.1778489843.git.mst@redhat.com> On Mon, May 11, 2026 at 05:03:41AM -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 > Assisted-by: Claude:claude-opus-4-6 > Assisted-by: cursor-agent:GPT-5.4-xhigh Reviewed-by: Gregory Price > --- > 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 >