lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ca9e4ebb-e6b5-475b-8a21-a261e27c3ca7@kernel.org>
Date: Mon, 19 Jan 2026 23:22:08 +0100
From: "David Hildenbrand (Red Hat)" <david@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org, linuxppc-dev@...ts.ozlabs.org,
 Broadcom internal kernel review list
 <bcm-kernel-feedback-list@...adcom.com>, linux-doc@...r.kernel.org,
 virtualization@...ts.linux.dev, Andrew Morton <akpm@...ux-foundation.org>,
 Oscar Salvador <osalvador@...e.de>,
 Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
 "Liam R. Howlett" <Liam.Howlett@...cle.com>, Vlastimil Babka
 <vbabka@...e.cz>, Mike Rapoport <rppt@...nel.org>,
 Suren Baghdasaryan <surenb@...gle.com>, Michal Hocko <mhocko@...e.com>,
 Jonathan Corbet <corbet@....net>, Madhavan Srinivasan <maddy@...ux.ibm.com>,
 Michael Ellerman <mpe@...erman.id.au>, Nicholas Piggin <npiggin@...il.com>,
 Christophe Leroy <christophe.leroy@...roup.eu>, Arnd Bergmann
 <arnd@...db.de>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 Jerrin Shaji George <jerrin.shaji-george@...adcom.com>,
 "Michael S. Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>,
 Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Eugenio Pérez
 <eperezma@...hat.com>, Zi Yan <ziy@...dia.com>
Subject: Re: [PATCH v2 04/23] mm/balloon_compaction: centralize basic page
 migration handling

On 1/15/26 10:19, David Hildenbrand (Red Hat) wrote:
> Let's update the balloon page references, the balloon page list, the
> BALLOON_MIGRATE counter and the isolated-pages counter in
> balloon_page_migrate(), after letting the balloon->migratepage()
> callback deal with the actual inflation+deflation.
> 
> Note that we now perform the balloon list modifications outside of any
> implementation-specific locks: which is fine, there is nothing special
> about these page actions that the lock would be protecting.
> 
> The old page is already no longer in the list (isolated) and the new page
> is not yet in the list.
> 
> Let's use -ENOENT to communicate the special "inflation of new page
> failed after already deflating the old page" to balloon_page_migrate() so
> it can handle it accordingly.
> 
> While at it, rename balloon->b_dev_info to make it match the other
> functions. Also, drop the comment above balloon_page_migrate(), which
> seems unnecessary.
> 
> Signed-off-by: David Hildenbrand (Red Hat) <david@...nel.org>
> ---

Andrew, the following on top:

 From 4c8b4f0aba5859a4ec71c7449a98b10e0547237f Mon Sep 17 00:00:00 2001
From: "David Hildenbrand (Red Hat)" <david@...nel.org>
Date: Mon, 19 Jan 2026 23:20:41 +0100
Subject: [PATCH] fixup: mm/balloon_compaction: centralize basic page migration
  handling

Remove newline, talk about "page" instead of "old page" and avoid the
switch.

Signed-off-by: David Hildenbrand (Red Hat) <david@...nel.org>
---
  mm/balloon_compaction.c | 22 +++++++---------------
  1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index 5444c61bb9e76..b859411811d0b 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -247,29 +247,21 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
  		return -EAGAIN;
  
  	rc = b_dev_info->migratepage(b_dev_info, newpage, page, mode);
-	switch (rc) {
-	case 0:
-		spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+	if (rc < 0 && rc != -ENOENT)
+		return rc;
  
+	spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+	if (!rc) {
  		/* Insert the new page into the balloon list. */
  		get_page(newpage);
-
  		balloon_page_insert(b_dev_info, newpage);
-		__count_vm_event(BALLOON_MIGRATE);
-		break;
-	case -ENOENT:
-		spin_lock_irqsave(&b_dev_info->pages_lock, flags);
-
-		/* Old page was deflated but new page not inflated. */
-		__count_vm_event(BALLOON_DEFLATE);
-		break;
-	default:
-		return rc;
  	}
-
  	b_dev_info->isolated_pages--;
  	spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
  
+	/* If -ENOENT, page was deflated but new page not inflated. */
+	__count_vm_event(rc ? BALLOON_DEFLATE : BALLOON_MIGRATE);
+
  	/* Free the now-deflated page we isolated in balloon_page_isolate(). */
  	balloon_page_finalize(page);
  	put_page(page);
-- 
2.52.0


-- 
Cheers

David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ