]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/show_mem: optimize si_meminfo_node by reducing redundant code
authorYe Liu <liuye@kylinos.cn>
Tue, 25 Mar 2025 07:38:03 +0000 (15:38 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:48:08 +0000 (17:48 -0700)
commit26d4d18b79659054e451be9487937e31e63d0853
treecde8c434f0f68d36010e7bfa0d7f7bdd980b0124
parent2e976567233228ff928c2405f7e03ebb7fb7aa50
mm/show_mem: optimize si_meminfo_node by reducing redundant code

Refactors the si_meminfo_node() function by reducing redundant code and
improving readability.

Moved the calculation of managed_pages inside the existing loop that
processes pgdat->node_zones, eliminating the need for a separate loop.

Simplified the logic by removing unnecessary preprocessor conditionals.

Ensured that both totalram, totalhigh, and other memory statistics are
consistently set without duplication.

This change results in cleaner and more efficient code without altering
functionality.

Link: https://lkml.kernel.org/r/20250325073803.852594-1-ye.liu@linux.dev
Signed-off-by: Ye Liu <liuye@kylinos.cn>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/show_mem.c