[PATCH 2/2] mm/zswap: move `zswap_has_pool` to front of `if ()`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



`zwap_has_pool` is a simple boolean, so it should be tested first
to avoid unnecessarily calling `strcmp()`. Test `zswap_has_pool`
first to take advantage of the short-circuiting behavior of && in
`__zswap_param_set()`.

Signed-off-by: Joey Pabalinas <joeypabalinas@xxxxxxxxx>

 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/zswap.c b/mm/zswap.c
index a4f2dfaf9131694265..dbf35139471f692798 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -672,7 +672,7 @@ static int __zswap_param_set(const char *val, const struct kernel_param *kp,
 	}
 
 	/* no change required */
-	if (!strcmp(s, *(char **)kp->arg) && zswap_has_pool)
+	if (zswap_has_pool && !strcmp(s, *(char **)kp->arg))
 		return 0;
 
 	/* if this is load-time (pre-init) param setting,
-- 
2.15.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux