Re: [PATCH v3 2/2] mm: shmem: refactor thpsize_shmem_enabled_show() with helper arrays

From: Barry Song

Date: Fri May 22 2026 - 07:42:55 EST


On Mon, May 18, 2026 at 8:33 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>
> Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
> Tested-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
> Reviewed-by: Breno Leitao <leitao@xxxxxxxxxx>
> Reviewed-by: Lorenzo Stoakes <ljs@xxxxxxxxxx>

Reviewed-by: Barry Song <baohua@xxxxxxxxxx>