From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 9C5BF41B37F for ; Thu, 14 May 2026 14:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778770125; cv=none; b=f4wkKmQdsUWKEKR2nh3521oj2PKDHYQHtZcRmDS/wPTm8OeIBJcrNOIGLWnFQ1CxKAYEb/xy10iV2PRFo9jhec41VRBXPe4VTNemmJTcLeNhATjSSv1yRpfoIz7TwMKEB527OGo8WfxEdjy2U1qYDldbdrwGXnANJX5M75cq2oY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778770125; c=relaxed/simple; bh=RoTpsSxAqLzGHF6OpqnVTjznAOKm4xLbpMTGt0b2oIw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uhYRhIg/aADWg8jbSqkb9tF4dct2zY66BJm4OWSIE6s7Z6+j99bSwC7WXmYnlMekXiA5jdztMPAnBssjg7utcbm63qo/q6slXr19cF+BbdUsNoex/MN7h+0JhZ0wxzlePfDq+/bAnzAIrWdCwNBhA85stAI3uoQX8Sub27tAJN8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=jNSDetyu; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=X6ueRhit; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jNSDetyu"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="X6ueRhit" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778770122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8lq5bA9PpVd8zAdeuT9RbCrpou31meXet2f2WjOjauE=; b=jNSDetyuHW4KP7OyjgEYCWBY1zXGu1rgWZDcmK+ANdt04k5MKPTBSV+OCVmiZ2LwP7vXMl /MPSGf2LIjd8GSVNRmh2vmPIGJxst/jDsWOXV5pAuQq6rxdqxmbIsf+Ft3FC0VfHePCfG4 6bfcYzJbWrCrHFqlReAtLGUhkXHPO1M= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-125-2BNCGzq7ObaWvF2U4xuWdw-1; Thu, 14 May 2026 10:48:36 -0400 X-MC-Unique: 2BNCGzq7ObaWvF2U4xuWdw-1 X-Mimecast-MFC-AGG-ID: 2BNCGzq7ObaWvF2U4xuWdw_1778770115 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-45dbbbf8d57so1111724f8f.3 for ; Thu, 14 May 2026 07:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778770115; x=1779374915; 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=8lq5bA9PpVd8zAdeuT9RbCrpou31meXet2f2WjOjauE=; b=X6ueRhitCWao1c+IgT/ZBfFhARHRO36tEprOunjrSnZUlymNM556WO8F+igNxlTOEq JKWm8Tp4RBGZ49xrDY13+olVM/POcw6rBgL5W4qUkQfYTNQhRKmvBWthvacQ7yGB0vGs 22QsNTaVS/drme6PQ36dVa5c2f+ssSY5S6NPennE6O5D2jHhxQr9Rb/wgWTALm3qRVA6 /k+VKwcpjFSnlLRT8KvHQHdkbBqd9eA31FgpJ+IKroMGniFaZ28W++lc1RRTuZ4cw5O0 4FXYWR9bidIAz7pDW2Ls9n2VtP1SP0QJAMYSQn2M1V5BLW7DBZMC12IAnWO4axmGJApB N11A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778770115; x=1779374915; 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=8lq5bA9PpVd8zAdeuT9RbCrpou31meXet2f2WjOjauE=; b=GvvVP1x5A8egkr/Z9446jhyCTCOfGGhy6nEUav5mWW1kFJXre2RexSPhTHWYND398C yVfcIhcle0hNmurznfuceZzy6D1tF79kEXDJ7sjJBmXXT4HJPRD3Pn+UGm1p1V559jqL KnjVPyTDVQDM1gPw6+mewLmjZK/H6PvtP9EYEVqlVWohz+YJhfwREtXkcRkAH3wOJHyP g9TPg9yvYqLHpt3t5P74CZ7vUu037STfwrG1pT+cS5hY5yM2agVkPMB/WwJCL8AXPXEj jYrOlQXx8U+CjG5CSpWwpFUCWQrnoZz0RnFk1D6Bh8Iby33JzbIa4XBX7JEIrowrxDqU IvQQ== X-Gm-Message-State: AOJu0YxCkLIE3Kilb2KhlYWwGCM40tLx8AygNha6zIlSRDrwoJ7SRP6u fZabhixY+rWjSF4UMb/pNPRwFngeG/87FT5nKTszJdc2MBLk5nobAZUWDI0FofC7cJLMfRHhgpR Pnz4F3CO+4xK6BvRLstdN8XVQd68YWCtTDVsoAqEzEwyDnjWkxvqt+H0OupXtdlVosA== X-Gm-Gg: Acq92OFHLiYRuAY0fvrtL2GzxGyWWLyn6P8g+6bTttqri7mPQSavK8STLLd2D34SUw9 fAPlTlM94NNAxgjTSRLuESmwkWaxdlMlsWHRQ/13dP6iAc1gSfc2+AXx7qdbSYwu5dtaGHfJtn+ vNnc/ly7FmT5JKPV02AmqPWGuq+rExQUqA5THzDY1MK30S0DISN/FtE23GnnnrG80C1exQb7gx8 P9RnrweiQs6M3RwEWlXbmq7MdsOkDqyIICJp0+h3YHeJLtDO5ziHva6yPdH9y/FogF5YxDb0XKg DPpbND87wq9fg3/rl+Lh2y7rxL+M9m91YDoINUB9a+qw7azKj/kldr05jFYm9t7dbCFWfMNDKxs u1xwiWSpUzpujZh8eXKDjSIuXGglrQeMDvzql1ULY X-Received: by 2002:a05:600c:8589:b0:48f:dfe3:dae3 with SMTP id 5b1f17b1804b1-48fdfe3dc80mr22680935e9.17.1778770114864; Thu, 14 May 2026 07:48:34 -0700 (PDT) X-Received: by 2002:a05:600c:8589:b0:48f:dfe3:dae3 with SMTP id 5b1f17b1804b1-48fdfe3dc80mr22680155e9.17.1778770114350; Thu, 14 May 2026 07:48:34 -0700 (PDT) Received: from redhat.com (IGLD-80-230-48-7.inter.net.il. [80.230.48.7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48fe46118a1sm4126555e9.10.2026.05.14.07.48.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 07:48:33 -0700 (PDT) Date: Thu, 14 May 2026 10:48:28 -0400 From: "Michael S. Tsirkin" To: Gregory Price 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: <20260514104735-mutt-send-email-mst@kernel.org> 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 Thu, May 14, 2026 at 07:51:03AM -0400, Gregory Price wrote: > 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 Not that I can see, no. -- MST