linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zsmalloc: Rework the list_add code in insert_zspage()
@ 2020-10-15 13:01 Miaohe Lin
  2020-10-15 18:51 ` Minchan Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Miaohe Lin @ 2020-10-15 13:01 UTC (permalink / raw)
  To: akpm, minchan, ngupta, sergey.senozhatsky.work
  Cc: linux-mm, linux-kernel, linmiaohe

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(-)

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]);
 }
 
 /*
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] zsmalloc: Rework the list_add code in insert_zspage()
  2020-10-15 13:01 [PATCH] zsmalloc: Rework the list_add code in insert_zspage() Miaohe Lin
@ 2020-10-15 18:51 ` Minchan Kim
  2020-10-16  0:27   ` Sergey Senozhatsky
  0 siblings, 1 reply; 3+ messages in thread
From: Minchan Kim @ 2020-10-15 18:51 UTC (permalink / raw)
  To: Miaohe Lin, Andrew Morton
  Cc: akpm, ngupta, sergey.senozhatsky.work, linux-mm, linux-kernel

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>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] zsmalloc: Rework the list_add code in insert_zspage()
  2020-10-15 18:51 ` Minchan Kim
@ 2020-10-16  0:27   ` Sergey Senozhatsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Senozhatsky @ 2020-10-16  0:27 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Miaohe Lin, Andrew Morton, ngupta, sergey.senozhatsky.work,
	linux-mm, linux-kernel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-16  0:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 13:01 [PATCH] zsmalloc: Rework the list_add code in insert_zspage() Miaohe Lin
2020-10-15 18:51 ` Minchan Kim
2020-10-16  0:27   ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).