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.133.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 54A622D3EC7 for ; Thu, 14 May 2026 15:34:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778772867; cv=none; b=ZsZCWtcXKRxvD7M4rnAldsS6puWThmHl6CZQQxVhfxKV4XJJOrgG2CJtk6xbEQTF+z7WAs2I6xz2KLLd4zTNpil1mnhszF5E+pMJtQTztIPP2NHed+H5K7LP0KwCCi2km6AoAGVB6Vyh/m9ThVm2SE9rQTqNovMge4KGlKg4jKY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778772867; c=relaxed/simple; bh=CHD1VwchtvP9g5VyScF+zybP9GHn0GYWzM4e1ldl/7k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KxlSPW0ZwhWqOa9ypAyJnLEhDoGVhTjtM8pgXgHgGissI/HZ6r5LmiHyus89XV07OaumODUxlKgdWzZc5c/GwfFDqh3lQht5LrpeDvZ070JXZe0664NG56Ap9o1Y0ANmmQhU8WLBauw65vSb9Sfpk/uRSen4CSF1cSrYlmBPuTg= 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=ZberkJql; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=TcxgaydN; arc=none smtp.client-ip=170.10.133.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="ZberkJql"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="TcxgaydN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778772865; 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=E+CWg5lxx32FMjsqcYIsFdKwXQ5ffiqlurIUVj9N3ys=; b=ZberkJqlH3gdIdfD0S9VGnTFTct+76E00n0bxWjtXHpJ3QLHaMrZFt9hBcKPv+5pK32I4B CAk6WJhiTBj/Yk5AWxgbZdEjTaz7ZhX43WZS2iNtO5/EPi3jr7v6/zbA7fEET6prMlXVlH bk5L6Q7YDR65zK2zHyoslx8uEvRhfTk= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-590-msw4cGo_P7SqUfowO2embA-1; Thu, 14 May 2026 11:34:23 -0400 X-MC-Unique: msw4cGo_P7SqUfowO2embA-1 X-Mimecast-MFC-AGG-ID: msw4cGo_P7SqUfowO2embA_1778772861 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-48fe3e73da6so1774385e9.2 for ; Thu, 14 May 2026 08:34:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778772861; x=1779377661; 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=E+CWg5lxx32FMjsqcYIsFdKwXQ5ffiqlurIUVj9N3ys=; b=TcxgaydNo0Zw8Fxr/oFhWW/1RcCGcisB86K7QqjfCZocITbdp6Ya2G7V5IK9A3W9FS l5dbn5ako4+9mF6Rtqb39z2hxjfJV/6+5jNJvcECWssyn/NJkl/misaCJ16FVRtTwUxl gfHzkZnZ8nXUXmf1S/SzVX7jFXzhBru5IfJZIgEzs8PQBmVBSi8oRq4vGQEaNUtXDGkc ZqdWTe+EmSV0o/DAgCbJIBe9qKmzhIIr0txgj+2VYZ7jOtZa8hXUeIqf/E2DS7gcOjMi B/+BX3zCBwTsWnrz9fFBID6HXLw7xbHF8ddzkUJU4DMoj9hnW1NWuhzO4Lxz4z7hRPg7 exrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778772861; x=1779377661; 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=E+CWg5lxx32FMjsqcYIsFdKwXQ5ffiqlurIUVj9N3ys=; b=AHea8298dAX0l5jnhrnkP2OkQ5HP/CXLopDyUgZxafXFho0Y5HaKL5MdiKYeu5M63G chRLcl06Oo/LU4h+oGDUXqmqFd6Y0GGPIv7/zGLLLrplxjx3nkAaWEK8sgHwJSWSHfbj O9k7VF1pwJ4AStW0L/wkh4gmfNYJmHEQ1DRPfe4lkvhMWAOjv/v2nVfXBg7qVl1x4t6T Div+k34Ws+INo2Pkun+iApV7ZvNiCcZ//LH4nR6Cr0jGXW5KFLjjLgi9UuIUcMZoTo3g bBYwowUt5nKXk1KnICKEvmtH/JTU9JhTXtewXjAmluxutTKc0++3YRK3do9TRrAd1Ldm KB3g== X-Gm-Message-State: AOJu0YyqZmR//G9nxude9VTJ9IvbRZKws02iWo17IABeFCPPgPlfnJp6 tJ/o1+SkTsro43aD1j0B3Y8vCNxx6t5TqnxEYBOWVnfKIjxORKLSrTg4vXvEPbYHtMIZfyFYnDo H0cJBCOXJ1g1V17CqcOfxVnnroFBjwWTORBWNBk6iofGzfkqiOkzXvXqQz4zjcLyvDg== X-Gm-Gg: Acq92OHqaoGn4qCwxPuwQycBP/hdJmiNmk8FjsJpOow6sqEH2uo3ePfJVo8HMSmHNHY SqutLAK9DMPM/Df6rUKtygQThqj0FSpw+p3AvjvdL09ddsxp/VIaGbYSSWn8cWmdtHBIAtRBKRb iyxATOqbY+jvROTqzq6EKzFARB+z3aB06r/k1Gp/LW4Dl7CxEN7tpGhvnLhz7389wVeuyW/4Dou GxGh3qdAUm/UuUROrmOtHu//4Tyomwn4Lzrfy6e2QlGoOipCwdEwPko1qfOK+Hs0M8ApCStfQvd 9l/ysFQNprmHqvUahymxBdqDGsu9RgEp38HS4MdMJwW7kbHwqp3fP/Psg+edqa2msW7RdXy+BWV 6YySxOK2vFSEtGVN0vipfw/pGR0vRlof+93MwvPVc X-Received: by 2002:a05:600c:348e:b0:489:1f97:6b1d with SMTP id 5b1f17b1804b1-48fc9a5b56amr127677595e9.28.1778772860711; Thu, 14 May 2026 08:34:20 -0700 (PDT) X-Received: by 2002:a05:600c:348e:b0:489:1f97:6b1d with SMTP id 5b1f17b1804b1-48fc9a5b56amr127676625e9.28.1778772860100; Thu, 14 May 2026 08:34:20 -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-48fdafb6145sm33187345e9.1.2026.05.14.08.34.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 08:34:19 -0700 (PDT) Date: Thu, 14 May 2026 11:34:14 -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: <20260514113337-mutt-send-email-mst@kernel.org> References: <20260514104735-mutt-send-email-mst@kernel.org> 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 11:32:26AM -0400, Gregory Price wrote: > On Thu, May 14, 2026 at 10:48:28AM -0400, Michael S. Tsirkin wrote: > > 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. > > > > You do this exact thing again later :] > > https://lore.kernel.org/linux-mm/9a22e0f9bbe1278913754db6df76e291a006181a.1778616612.git.mst@redhat.com/ > > ~Gregory I mean yes, reported and zeroed) Just zeroed does not exist at this stage in the series.