lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1422107403-10071-1-git-send-email-opensource.ganesh@gmail.com>
Date:	Sat, 24 Jan 2015 21:50:03 +0800
From:	Ganesh Mahendran <opensource.ganesh@...il.com>
To:	minchan@...nel.org, ngupta@...are.org
Cc:	akpm@...ux-foundation.org, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Ganesh Mahendran <opensource.ganesh@...il.com>
Subject: [PATCH] mm/zsmalloc: avoid unnecessary iteration when freeing
 size_class

The pool->size_class[i] is assigned with the i from (zs_size_classes - 1) to 0.
So if we failed in zs_create_pool(), we only need to iterate from (zs_size_classes - 1)
to i, instead of from 0 to (zs_size_classes - 1)

Signed-off-by: Ganesh Mahendran <opensource.ganesh@...il.com>
Cc: Nitin Gupta <ngupta@...are.org>
Cc: Minchan Kim <minchan@...nel.org>
---
 mm/zsmalloc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 16617e9..e6fa3da 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1433,12 +1433,12 @@ void zs_destroy_pool(struct zs_pool *pool)
 
 	zs_pool_stat_destroy(pool);
 
-	for (i = 0; i < zs_size_classes; i++) {
+	for (i = zs_size_classes - 1; i >= 0; i--) {
 		int fg;
 		struct size_class *class = pool->size_class[i];
 
 		if (!class)
-			continue;
+			break;
 
 		if (class->index != i)
 			continue;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ