Thread (138 messages) 138 messages, 5 authors, 2025-07-03

Re: [PATCH v1 12/29] mm/zsmalloc: stop using __ClearPageMovable()

From: Sergey Senozhatsky <senozhatsky@chromium.org>
Date: 2025-07-03 03:22:36
Also in: linux-doc, linux-fsdevel, linux-mm, lkml, virtualization

On (25/07/03 11:28), Sergey Senozhatsky wrote:
quoted
quoted
quoted
quoted
quoted
   static int zs_page_migrate(struct page *newpage, struct page *page,
@@ -1736,6 +1736,13 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
   	unsigned long old_obj, new_obj;
   	unsigned int obj_idx;
+	/*
+	 * TODO: nothing prevents a zspage from getting destroyed while
+	 * isolated: we should disallow that and defer it.
+	 */
Can you elaborate?
We can only free a zspage in free_zspage() while the page is locked.

After we isolated a zspage page for migration (under page lock!), we drop
                       ^^ a physical page? (IOW zspage chain page?)
quoted
the lock again, to retake the lock when trying to migrate it.

That means, there is a window where a zspage can be freed although the page
is isolated for migration.
I see, thanks.  Looks somewhat fragile.  Is this a new thing?
No, it's been like that forever. And I was surprised that only zsmalloc
behaves that way
Oh, that makes two of us.
I sort of wonder if zs_page_migrate() VM_BUG_ON_PAGE() removal and
zspage check addition need to be landed outside of this series, as
a zsmalloc fixup.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help