summaryrefslogtreecommitdiffstats
path: root/mm/zsmalloc.c
diff options
context:
space:
mode:
authorMiaohe Lin <linmiaohe@huawei.com>2020-12-14 19:14:22 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2020-12-15 12:13:46 -0800
commit110ceb8287fd0af104a7a15db93534ab0dc2bc21 (patch)
tree9b5ba95f7803a1901c8ab1e6e7280e2a02d1c8d8 /mm/zsmalloc.c
parent1ec3b5fe6eec782f4e5e0a80e4ce1909ffd5d161 (diff)
downloadlinux-stable-110ceb8287fd0af104a7a15db93534ab0dc2bc21.tar.gz
linux-stable-110ceb8287fd0af104a7a15db93534ab0dc2bc21.tar.bz2
linux-stable-110ceb8287fd0af104a7a15db93534ab0dc2bc21.zip
mm/zsmalloc.c: rework the list_add code in insert_zspage()
Rework the list_add code to make it more readable and simple. Link: https://lkml.kernel.org/r/20201015130107.65195-1-linmiaohe@huawei.com Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Acked-by: Minchan Kim <minchan@kernel.org> Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/zsmalloc.c')
-rw-r--r--mm/zsmalloc.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index cdfaaadea8ff..7289f502ffac 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -726,13 +726,10 @@ static void insert_zspage(struct size_class *class,
* We want to see more ZS_FULL pages and less almost empty/full.
* Put pages with higher ->inuse first.
*/
- if (head) {
- if (get_zspage_inuse(zspage) < get_zspage_inuse(head)) {
- list_add(&zspage->list, &head->list);
- return;
- }
- }
- list_add(&zspage->list, &class->fullness_list[fullness]);
+ if (head && get_zspage_inuse(zspage) < get_zspage_inuse(head))
+ list_add(&zspage->list, &head->list);
+ else
+ list_add(&zspage->list, &class->fullness_list[fullness]);
}
/*