All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 065/101] mm/zsmalloc: take obj index back from find_alloced_obj
@ 2016-07-28 22:47 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2016-07-28 22:47 UTC (permalink / raw)
  To: torvalds, mm-commits, akpm, opensource.ganesh, minchan,
	sergey.senozhatsky

From: Ganesh Mahendran <opensource.ganesh@gmail.com>
Subject: mm/zsmalloc: take obj index back from find_alloced_obj

the obj index value should be updated after return from
find_alloced_obj() to avoid CPU burning caused by unnecessary
object scanning.

Link: http://lkml.kernel.org/r/1467882338-4300-2-git-send-email-opensource.ganesh@gmail.com
Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/zsmalloc.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff -puN mm/zsmalloc.c~mm-zsmalloc-take-obj-index-back-from-find_alloced_obj mm/zsmalloc.c
--- a/mm/zsmalloc.c~mm-zsmalloc-take-obj-index-back-from-find_alloced_obj
+++ a/mm/zsmalloc.c
@@ -1741,10 +1741,11 @@ static void zs_object_copy(struct size_c
  * return handle.
  */
 static unsigned long find_alloced_obj(struct size_class *class,
-					struct page *page, int index)
+					struct page *page, int *obj_idx)
 {
 	unsigned long head;
 	int offset = 0;
+	int index = *obj_idx;
 	unsigned long handle = 0;
 	void *addr = kmap_atomic(page);
 
@@ -1765,6 +1766,9 @@ static unsigned long find_alloced_obj(st
 	}
 
 	kunmap_atomic(addr);
+
+	*obj_idx = index;
+
 	return handle;
 }
 
@@ -1790,7 +1794,7 @@ static int migrate_zspage(struct zs_pool
 	int ret = 0;
 
 	while (1) {
-		handle = find_alloced_obj(class, s_page, obj_idx);
+		handle = find_alloced_obj(class, s_page, &obj_idx);
 		if (!handle) {
 			s_page = get_next_page(s_page);
 			if (!s_page)
_

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-28 22:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-28 22:47 [patch 065/101] mm/zsmalloc: take obj index back from find_alloced_obj akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.