From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753244AbcGDGva (ORCPT ); Mon, 4 Jul 2016 02:51:30 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34256 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753050AbcGDGv1 (ORCPT ); Mon, 4 Jul 2016 02:51:27 -0400 From: Ganesh Mahendran To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, minchan@kernel.org, ngupta@vflare.org, sergey.senozhatsky.work@gmail.com, rostedt@goodmis.org, mingo@redhat.com, Ganesh Mahendran Subject: [PATCH v2 3/8] mm/zsmalloc: take obj index back from find_alloced_obj Date: Mon, 4 Jul 2016 14:49:54 +0800 Message-Id: <1467614999-4326-3-git-send-email-opensource.ganesh@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467614999-4326-1-git-send-email-opensource.ganesh@gmail.com> References: <1467614999-4326-1-git-send-email-opensource.ganesh@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org the obj index value should be updated after return from find_alloced_obj() to avoid CPU buring caused by unnecessary object scanning. Signed-off-by: Ganesh Mahendran ---- v2: - update commit description Hi, Minchan: find_alloced_obj() already has the argument which use the obj_idx name. So I use index as the local variable name in this function. Is this OK? --- mm/zsmalloc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 8915a1d..92b043c 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1744,10 +1744,11 @@ static void zs_object_copy(struct size_class *class, unsigned long dst, * 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); @@ -1768,6 +1769,9 @@ static unsigned long find_alloced_obj(struct size_class *class, } kunmap_atomic(addr); + + *obj_idx = index; + return handle; } @@ -1793,7 +1797,7 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class, 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) -- 1.9.1