Skip to content

Commit b5f469a

Browse files
Alex Shiakpm00
authored andcommitted
mm/zsmalloc: introduce __zpdesc_clear/set_zsmalloc()
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>
1 parent fc5eec0 commit b5f469a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

mm/zpdesc.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ static inline void __zpdesc_set_movable(struct zpdesc *zpdesc,
155155
__SetPageMovable(zpdesc_page(zpdesc), mops);
156156
}
157157

158+
static inline void __zpdesc_set_zsmalloc(struct zpdesc *zpdesc)
159+
{
160+
__SetPageZsmalloc(zpdesc_page(zpdesc));
161+
}
162+
163+
static inline void __zpdesc_clear_zsmalloc(struct zpdesc *zpdesc)
164+
{
165+
__ClearPageZsmalloc(zpdesc_page(zpdesc));
166+
}
167+
158168
static inline bool zpdesc_is_isolated(struct zpdesc *zpdesc)
159169
{
160170
return PageIsolated(zpdesc_page(zpdesc));

mm/zsmalloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,13 +1001,13 @@ static struct zspage *alloc_zspage(struct zs_pool *pool,
10011001
if (!zpdesc) {
10021002
while (--i >= 0) {
10031003
zpdesc_dec_zone_page_state(zpdescs[i]);
1004-
__ClearPageZsmalloc(zpdesc_page(zpdescs[i]));
1004+
__zpdesc_clear_zsmalloc(zpdescs[i]);
10051005
free_zpdesc(zpdescs[i]);
10061006
}
10071007
cache_free_zspage(pool, zspage);
10081008
return NULL;
10091009
}
1010-
__SetPageZsmalloc(zpdesc_page(zpdesc));
1010+
__zpdesc_set_zsmalloc(zpdesc);
10111011

10121012
zpdesc_inc_zone_page_state(zpdesc);
10131013
zpdescs[i] = zpdesc;
@@ -1786,7 +1786,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
17861786
VM_BUG_ON_PAGE(!zpdesc_is_isolated(zpdesc), zpdesc_page(zpdesc));
17871787

17881788
/* We're committed, tell the world that this is a Zsmalloc page. */
1789-
__SetPageZsmalloc(zpdesc_page(newzpdesc));
1789+
__zpdesc_set_zsmalloc(newzpdesc);
17901790

17911791
/* The page is locked, so this pointer must remain valid */
17921792
zspage = get_zspage(zpdesc);

0 commit comments

Comments
 (0)