]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/zsmalloc: introduce __zpdesc_clear/set_zsmalloc()
authorAlex Shi <alexs@kernel.org>
Mon, 16 Dec 2024 15:04:49 +0000 (00:04 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 26 Jan 2025 04:22:35 +0000 (20:22 -0800)
Add helper __zpdesc_clear_zsmalloc() for __ClearPageZsmalloc(),
__zpdesc_set_zsmalloc() for __SetPageZsmalloc(), and use them in callers.

[42.hyeyoo@gmail.com: keep reset_zpdesc() to use struct page]
Link: https://lkml.kernel.org/r/20241216150450.1228021-19-42.hyeyoo@gmail.com
Signed-off-by: Alex Shi <alexs@kernel.org>
Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Acked-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/zpdesc.h
mm/zsmalloc.c

index 4a4e68446f5a2e6ae9624cb89bbb1a29a6e0e6fd..fa47fece22372e9a283ec2f7b8aba30b9904c6dd 100644 (file)
@@ -155,6 +155,16 @@ static inline void __zpdesc_set_movable(struct zpdesc *zpdesc,
        __SetPageMovable(zpdesc_page(zpdesc), mops);
 }
 
+static inline void __zpdesc_set_zsmalloc(struct zpdesc *zpdesc)
+{
+       __SetPageZsmalloc(zpdesc_page(zpdesc));
+}
+
+static inline void __zpdesc_clear_zsmalloc(struct zpdesc *zpdesc)
+{
+       __ClearPageZsmalloc(zpdesc_page(zpdesc));
+}
+
 static inline bool zpdesc_is_isolated(struct zpdesc *zpdesc)
 {
        return PageIsolated(zpdesc_page(zpdesc));
index 69d1a7ea1a0d124223f475ad06721849d7d6b47f..817626a351f89dd99fb5f08e89bf98a54f22af85 100644 (file)
@@ -1001,13 +1001,13 @@ static struct zspage *alloc_zspage(struct zs_pool *pool,
                if (!zpdesc) {
                        while (--i >= 0) {
                                zpdesc_dec_zone_page_state(zpdescs[i]);
-                               __ClearPageZsmalloc(zpdesc_page(zpdescs[i]));
+                               __zpdesc_clear_zsmalloc(zpdescs[i]);
                                free_zpdesc(zpdescs[i]);
                        }
                        cache_free_zspage(pool, zspage);
                        return NULL;
                }
-               __SetPageZsmalloc(zpdesc_page(zpdesc));
+               __zpdesc_set_zsmalloc(zpdesc);
 
                zpdesc_inc_zone_page_state(zpdesc);
                zpdescs[i] = zpdesc;
@@ -1786,7 +1786,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
        VM_BUG_ON_PAGE(!zpdesc_is_isolated(zpdesc), zpdesc_page(zpdesc));
 
        /* We're committed, tell the world that this is a Zsmalloc page. */
-       __SetPageZsmalloc(zpdesc_page(newzpdesc));
+       __zpdesc_set_zsmalloc(newzpdesc);
 
        /* The page is locked, so this pointer must remain valid */
        zspage = get_zspage(zpdesc);