Commit 67eaedc1 authored by Chengming Zhou's avatar Chengming Zhou Committed by Andrew Morton

mm/zsmalloc: remove_zspage() don't need fullness parameter

We must remove_zspage() from its current fullness list, then use
insert_zspage() to update its fullness and insert to new fullness list. 
Obviously, remove_zspage() doesn't need the fullness parameter.

Link: https://lkml.kernel.org/r/20240220-b4-zsmalloc-cleanup-v1-2-5c5ee4ccdd87@bytedance.comSigned-off-by: default avatarChengming Zhou <zhouchengming@bytedance.com>
Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent a6a8cdfd
...@@ -687,10 +687,10 @@ static void insert_zspage(struct size_class *class, ...@@ -687,10 +687,10 @@ static void insert_zspage(struct size_class *class,
* This function removes the given zspage from the freelist identified * This function removes the given zspage from the freelist identified
* by <class, fullness_group>. * by <class, fullness_group>.
*/ */
static void remove_zspage(struct size_class *class, static void remove_zspage(struct size_class *class, struct zspage *zspage)
struct zspage *zspage,
int fullness)
{ {
int fullness = zspage->fullness;
VM_BUG_ON(list_empty(&class->fullness_list[fullness])); VM_BUG_ON(list_empty(&class->fullness_list[fullness]));
list_del_init(&zspage->list); list_del_init(&zspage->list);
...@@ -716,7 +716,7 @@ static int fix_fullness_group(struct size_class *class, struct zspage *zspage) ...@@ -716,7 +716,7 @@ static int fix_fullness_group(struct size_class *class, struct zspage *zspage)
if (newfg == currfg) if (newfg == currfg)
goto out; goto out;
remove_zspage(class, zspage, currfg); remove_zspage(class, zspage);
insert_zspage(class, zspage, newfg); insert_zspage(class, zspage, newfg);
out: out:
return newfg; return newfg;
...@@ -878,7 +878,7 @@ static void free_zspage(struct zs_pool *pool, struct size_class *class, ...@@ -878,7 +878,7 @@ static void free_zspage(struct zs_pool *pool, struct size_class *class,
return; return;
} }
remove_zspage(class, zspage, ZS_INUSE_RATIO_0); remove_zspage(class, zspage);
__free_zspage(pool, class, zspage); __free_zspage(pool, class, zspage);
} }
...@@ -1609,7 +1609,7 @@ static struct zspage *isolate_src_zspage(struct size_class *class) ...@@ -1609,7 +1609,7 @@ static struct zspage *isolate_src_zspage(struct size_class *class)
zspage = list_first_entry_or_null(&class->fullness_list[fg], zspage = list_first_entry_or_null(&class->fullness_list[fg],
struct zspage, list); struct zspage, list);
if (zspage) { if (zspage) {
remove_zspage(class, zspage, fg); remove_zspage(class, zspage);
return zspage; return zspage;
} }
} }
...@@ -1626,7 +1626,7 @@ static struct zspage *isolate_dst_zspage(struct size_class *class) ...@@ -1626,7 +1626,7 @@ static struct zspage *isolate_dst_zspage(struct size_class *class)
zspage = list_first_entry_or_null(&class->fullness_list[fg], zspage = list_first_entry_or_null(&class->fullness_list[fg],
struct zspage, list); struct zspage, list);
if (zspage) { if (zspage) {
remove_zspage(class, zspage, fg); remove_zspage(class, zspage);
return zspage; return zspage;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment