linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] mm/zsmalloc: remove redundant SetPagePrivate2 in create_page_chain
@ 2017-02-14 12:48 Yisheng Xie
  2017-02-14 16:16 ` Sergey Senozhatsky
  2017-02-15  7:13 ` Minchan Kim
  0 siblings, 2 replies; 3+ messages in thread
From: Yisheng Xie @ 2017-02-14 12:48 UTC (permalink / raw)
  To: akpm
  Cc: minchan, ngupta, sergey.senozhatsky.work, linux-mm, linux-kernel,
	guohanjun

We had used page->lru to link the component pages (except the first
page) of a zspage, and used INIT_LIST_HEAD(&page->lru) to init it.
Therefore, to get the last page's next page, which is NULL, we had to
use page flag PG_Private_2 to identify it.

But now, we use page->freelist to link all of the pages in zspage and
init the page->freelist as NULL for last page, so no need to use
PG_Private_2 anymore.

This patch is to remove redundant SetPagePrivate2 in create_page_chain
and ClearPagePrivate2 in reset_page(). Maybe can save few cycles for
migration of zsmalloc page :)

Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
---
 mm/zsmalloc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 9cc3c0b..aa90f14 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -24,7 +24,6 @@
  *
  * Usage of struct page flags:
  *	PG_private: identifies the first component page
- *	PG_private2: identifies the last component page
  *	PG_owner_priv_1: indentifies the huge component page
  *
  */
@@ -938,7 +937,6 @@ static void reset_page(struct page *page)
 {
 	__ClearPageMovable(page);
 	ClearPagePrivate(page);
-	ClearPagePrivate2(page);
 	set_page_private(page, 0);
 	page_mapcount_reset(page);
 	ClearPageHugeObject(page);
@@ -1085,7 +1083,7 @@ static void create_page_chain(struct size_class *class, struct zspage *zspage,
 	 * 2. each sub-page point to zspage using page->private
 	 *
 	 * we set PG_private to identify the first page (i.e. no other sub-page
-	 * has this flag set) and PG_private_2 to identify the last page.
+	 * has this flag set).
 	 */
 	for (i = 0; i < nr_pages; i++) {
 		page = pages[i];
@@ -1100,8 +1098,6 @@ static void create_page_chain(struct size_class *class, struct zspage *zspage,
 		} else {
 			prev_page->freelist = page;
 		}
-		if (i == nr_pages - 1)
-			SetPagePrivate2(page);
 		prev_page = page;
 	}
 }
-- 
1.7.12.4

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

* Re: [RFC] mm/zsmalloc: remove redundant SetPagePrivate2 in create_page_chain
  2017-02-14 12:48 [RFC] mm/zsmalloc: remove redundant SetPagePrivate2 in create_page_chain Yisheng Xie
@ 2017-02-14 16:16 ` Sergey Senozhatsky
  2017-02-15  7:13 ` Minchan Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Sergey Senozhatsky @ 2017-02-14 16:16 UTC (permalink / raw)
  To: Yisheng Xie
  Cc: akpm, minchan, ngupta, sergey.senozhatsky.work, linux-mm,
	linux-kernel, guohanjun

On (02/14/17 20:48), Yisheng Xie wrote:
> We had used page->lru to link the component pages (except the first
> page) of a zspage, and used INIT_LIST_HEAD(&page->lru) to init it.
> Therefore, to get the last page's next page, which is NULL, we had to
> use page flag PG_Private_2 to identify it.
> 
> But now, we use page->freelist to link all of the pages in zspage and
> init the page->freelist as NULL for last page, so no need to use
> PG_Private_2 anymore.
> 
> This patch is to remove redundant SetPagePrivate2 in create_page_chain
> and ClearPagePrivate2 in reset_page(). Maybe can save few cycles for
> migration of zsmalloc page :)
> 
> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>

looks good to me.

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

	-ss

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

* Re: [RFC] mm/zsmalloc: remove redundant SetPagePrivate2 in create_page_chain
  2017-02-14 12:48 [RFC] mm/zsmalloc: remove redundant SetPagePrivate2 in create_page_chain Yisheng Xie
  2017-02-14 16:16 ` Sergey Senozhatsky
@ 2017-02-15  7:13 ` Minchan Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Minchan Kim @ 2017-02-15  7:13 UTC (permalink / raw)
  To: Yisheng Xie
  Cc: akpm, ngupta, sergey.senozhatsky.work, linux-mm, linux-kernel, guohanjun

On Tue, Feb 14, 2017 at 08:48:29PM +0800, Yisheng Xie wrote:
> We had used page->lru to link the component pages (except the first
> page) of a zspage, and used INIT_LIST_HEAD(&page->lru) to init it.
> Therefore, to get the last page's next page, which is NULL, we had to
> use page flag PG_Private_2 to identify it.
> 
> But now, we use page->freelist to link all of the pages in zspage and
> init the page->freelist as NULL for last page, so no need to use
> PG_Private_2 anymore.
> 
> This patch is to remove redundant SetPagePrivate2 in create_page_chain
> and ClearPagePrivate2 in reset_page(). Maybe can save few cycles for
> migration of zsmalloc page :)
> 
> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
Acked-by: Minchan Kim <minchan@kernel.org>

Thanks, Yisheng!

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

end of thread, other threads:[~2017-02-15  7:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-14 12:48 [RFC] mm/zsmalloc: remove redundant SetPagePrivate2 in create_page_chain Yisheng Xie
2017-02-14 16:16 ` Sergey Senozhatsky
2017-02-15  7:13 ` Minchan Kim

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