diff mbox series

zsmalloc: Rework the list_add code in insert_zspage()

Message ID 20201015130107.65195-1-linmiaohe@huawei.com (mailing list archive)
State New, archived
Headers show
Series zsmalloc: Rework the list_add code in insert_zspage() | expand

Commit Message

Miaohe Lin Oct. 15, 2020, 1:01 p.m. UTC
Rework the list_add code to make it more readable and simplicity.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/zsmalloc.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Minchan Kim Oct. 15, 2020, 6:51 p.m. UTC | #1
On Thu, Oct 15, 2020 at 09:01:07AM -0400, Miaohe Lin wrote:
> Rework the list_add code to make it more readable and simplicity.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Sergey Senozhatsky Oct. 16, 2020, 12:27 a.m. UTC | #2
On (20/10/15 11:51), Minchan Kim wrote:
> On Thu, Oct 15, 2020 at 09:01:07AM -0400, Miaohe Lin wrote:
> > Rework the list_add code to make it more readable and simplicity.
> > 
> > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> Acked-by: Minchan Kim <minchan@kernel.org>

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss
diff mbox series

Patch

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 918c7b019b3d..b03bee2e1b5f 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -730,13 +730,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]);
 }
 
 /*