Re: [PATCH v5 07/12] zsmalloc: factor page chain functionality out

From
Minchan Kim <minchan@kernel.org>
Date
2016-05-17 01:02:26
Also in
lkml
Reply to
Sergey Senozhatsky, 2016-05-16
On Mon, May 16, 2016 at 11:14:20AM +0900, Sergey Senozhatsky wrote:
On (05/09/16 11:20), Minchan Kim wrote:
quoted
For page migration, we need to create page chain of zspage dynamically
so this patch factors it out from alloc_zspage.

Cc: Sergey Senozhatsky <redacted>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Reviewed-by: Sergey Senozhatsky <redacted>
Thanks!
[..]
quoted
+		page = alloc_page(flags);
+		if (!page) {
+			while (--i >= 0)
+				__free_page(pages[i]);
				put_page() ?

a minor nit, put_page() here probably will be in alignment
with __free_zspage(), which does put_page().
Normally, we use put_page in case that someone can grab a referece of
the page so we cannot free the page. Otherwise, alloc_page and
__free_page is more straight to me code readability POV.
	-ss
quoted
+			return NULL;
+		}
+		pages[i] = page;
 	}
 
+	create_page_chain(pages, class->pages_per_zspage);
+	first_page = pages[0];
+	init_zspage(class, first_page);
+
 	return first_page;
 }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Thread (28 messages) 28 messages, 3 authors, last reply 2016-05-17
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help