]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ksm: initialize the addr only once in rmap_walk_ksm
authorxu xin <xu.xin16@zte.com.cn>
Thu, 12 Feb 2026 11:29:32 +0000 (19:29 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:52:35 +0000 (13:52 -0700)
commit318d87b8fa733bebdc9c803657671df0b7b8b006
tree0d05da15c0cee980031bfceb0de3a32486a4ba23
parent34ca46cc6fc954782f859f0fc66e8fe9ce2c24f0
ksm: initialize the addr only once in rmap_walk_ksm

This is a minor performance optimization, especially when there are many
for-loop iterations, because the addr variable doesn't change across
iterations.

Therefore, it only needs to be initialized once before the loop.

Link: https://lkml.kernel.org/r/20260212192820223O_r2NQzSEPG_C56cs-z4l@zte.com.cn
Link: https://lkml.kernel.org/r/20260212192932941MSsJEAyoRW4YdLBN7_myn@zte.com.cn
Signed-off-by: xu xin <xu.xin16@zte.com.cn>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Hugh Dickins <hughd@google.com>
Cc: Wang Yaxin <wang.yaxin@zte.com.cn>
Cc: Yang Yang <yang.yang29@zte.com.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/ksm.c