From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 10712394497 for ; Thu, 14 May 2026 11:51:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778759470; cv=none; b=YeSP7+Ig5pYU0cc7Drsb5QvNn0eIRNk0W3qQlUbfXu6SA2HEVoMxsH/Nbjyph+5PB5d0K2v8gOpWT0eJnqLEJZ7GAluC1cUGnzZCFmQLAxA3AWnbZB3L5n5WvP/JvIBvNUvACwRFhrozG+uWnNw3GX2gBTPPD5pxOvc7HRDOlqU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778759470; c=relaxed/simple; bh=TDT8hciE5by+7p1FA4NNR45GEo+DRpRqNs9hjNu/cxg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Gcl1R1wVqp6ZJ/jEf7P3uyGWj8/LArHtAJkFNUxV1g16tmdYyBxnZ+2yjyOVo+crxdJtRzTmz/LqUh5JfpV30d91boi4Mul9AxFmah03EE6wXcwDy1HLT48GesVyZOAtKdX13LRYaS5a2RzDdMhlQyEthqIOCOeiYzk5WmK6Y0I= 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=AfRmcBPe; arc=none smtp.client-ip=209.85.222.178 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="AfRmcBPe" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-90ca6f20872so349433485a.0 for ; Thu, 14 May 2026 04:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1778759467; x=1779364267; 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=3otPrX8ylWiqgm/t2ct4ZpbOY2TynCo6XoPa75Eeyno=; b=AfRmcBPegFbZFpc6pLGQHG4TgyQpYNu9eZ95+dSVADEbJEV8FMe+rvSH4sFA799Z9R HwOimQGKuQ3gYa8BhfFUt+X+0qhX4vWie2AHqlkhP9AWYPJWHVqRpihHSC4G8zr6Grob zh44fYdSKeo4WvS9sxVK4tNx5OvkVSFyntGNBoAxVJLJfyIF9+zAOndcwrSwOQAPtQEe xzo+fL3jFGUfQnV2DHdQHdFYCRNHLxNLp7aVB6gVS8vLTJaeFOXZIIt5BrDYO8xW+fOZ mOjE53B6eqddoannI2KYgY1B98wQIxQCddN5gAwwz7JvEV8dCMEQKkSJ08+ziePDW5BC 2jyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778759467; x=1779364267; 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=3otPrX8ylWiqgm/t2ct4ZpbOY2TynCo6XoPa75Eeyno=; b=hZfUQTA6KjjC90xC6UaHz+ljWeIiF4RVc3domAuqksDtAnUuSV6Z4oe9GTP1/j3oGh gxpd8LeV8lxLncc+9Sn4qm/7YbXPfJub4mkNpKOyVGvySUU9i3Y6Af2bfZLxw8EfNzuI 6SxDXnFOyCNMOS05nO038v+IGjLlkyP5qjAkYHuLbrEmKY35V1AQ1AWs/VtgqagppMWA O3wntMZAXVmnKRYNHVMgQFE1kE/7ryfLg5KKFMbkBzSDc5iil4pdxuA2kQl46GZDu22T A9FuMR51rkmxOcxHkN+n0adMftXUcOwDwIQOLKT2dtvwk8hTF+ETrwkxI9PeCqJVqQNy aoLw== X-Gm-Message-State: AOJu0YxGY0iZ2DFVbVyub9SzVy3NtLd12jF2zmqEmclc2LZKFAM41E8a 1Xe28sbkh5lvN7D+dWir2KmN0w3VVur1R3RvIsGQJreHKeK7e6KOiLsGgjPJfAFtdsU= X-Gm-Gg: Acq92OHojDUjslCEwmoq3b5NcgVwMyWP+WI6QHjtVwVX5ejUGX12CDT0MqZIQcAiDtn 87ouTDJ1w1YXl0laGjtKneFGjK1dRLnxxhC+2hWQFNrr8+Y1BG0rXQDNkq4Hk8Z3DRt6i2DKyMl W5rpqLSE+8epM+GFym+jwwhd2WpDGU8RHiudsLIFPj3RpdeLwvbpkoPdHpa37URyjjUDpkcZyse Eui71kfaVOr70an6ck0PxCZwAT2riZsVXPmaVWkA8tL0P9VGnAkcaHa0ApC2kR0FYYa6D8bdagN Y7JVV6hBh7zr3RRshut1s1aplo8egK98k51XuH6vUO+goAQmfVrmn7ff0cGLOoq1tr8SXoBYqBf ZhF1rkJPEt6wSOyfzaj/PeRkn0S6Ij4RdBBZBbZCmou1tN43t5nw5j9b2bSorkZXopG+HoGOHfA 9BtABBGgGmTZ7pGJFMgaMJkXaBXhqfHYZnznIFal4quZdek7OE3XXxJ8ngLOeLMOeDVbvm/0Ziu HHvQoLzb2ab+AdlNEt5W8w= X-Received: by 2002:a05:620a:448a:b0:8d6:d217:96a0 with SMTP id af79cd13be357-910abf49b96mr451245385a.0.1778759466839; Thu, 14 May 2026 04:51:06 -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-910bd620fbcsm229997985a.42.2026.05.14.04.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 04:51:06 -0700 (PDT) Date: Thu, 14 May 2026 07:51:03 -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 02/31] mm: page_alloc: propagate PageReported flag across buddy splits Message-ID: References: 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: On Tue, May 12, 2026 at 05:05:16PM -0400, Michael S. Tsirkin wrote: > When a reported free page is split via expand() to satisfy a > smaller allocation, the sub-pages placed back on the free lists > lose the PageReported flag. This means they will be unnecessarily > re-reported to the hypervisor in the next reporting cycle, wasting > work. > > While I was unable to quantify the performance difference, it is > an obvious waste, even if small. > > Propagate the PageReported flag to sub-pages during expand(), > both in page_del_and_expand() and try_to_claim_block(), so > that they are recognized as already-reported. > > Signed-off-by: Michael S. Tsirkin > Assisted-by: Claude:claude-opus-4-6 ... snip ... > @@ -1731,9 +1740,10 @@ static __always_inline void page_del_and_expand(struct zone *zone, > int high, int migratetype) > { > int nr_pages = 1 << high; > + bool was_reported = page_reported(page); > > __del_page_from_free_list(page, zone, high, migratetype); > - nr_pages -= expand(zone, page, low, high, migratetype); > + nr_pages -= expand(zone, page, low, high, migratetype, was_reported); > account_freepages(zone, -nr_pages, migratetype); > } > Maybe mildly out of scope but worth asking: Are there other flags that should be retained/propogated on a split? If so, rather than pass was_reported, should we just take a temporary copy of the page flags and pass them all in? ~Gregory