Re: [PATCH v2 2/2] mm: huge_memory: refactor thpsize_shmem_enabled_show() with helper arrays

From: Baolin Wang

Date: Wed May 13 2026 - 22:42:18 EST


Subject line should be: 'mm: shmem: xxx'

On 5/13/26 5:45 PM, ranxiaokai627@xxxxxxx wrote:
From: Ran Xiaokai <ran.xiaokai@xxxxxxxxxx>

Replace the hardcoded if/else chain of test_bit() calls and string
literals in thpsize_shmem_enabled_show() with a loop over
huge_shmem_orders_by_mode[] and huge_shmem_enabled_mode_strings[] arrays.

This makes thpsize_shmem_enabled_show() consistent with
thpsize_shmem_enabled_store() and eliminates duplicated mode name strings.

Signed-off-by: Ran Xiaokai <ran.xiaokai@xxxxxxxxxx>
---

LGTM. Thanks.
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
Tested-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>