Re: [PATCH v4 2/2] mm: shmem: refactor thpsize_shmem_enabled_show() with helper arrays
From: David Hildenbrand (Arm)
Date: Tue May 26 2026 - 08:28:51 EST
On 5/25/26 12:27, 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>
> Reviewed-by: Barry Song <baohua@xxxxxxxxxx>
> Reviewed-by: Breno Leitao <leitao@xxxxxxxxxx>
> Reviewed-by: Lorenzo Stoakes <ljs@xxxxxxxxxx>
> Tested-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
> Tested-by: Lance Yang <lance.yang@xxxxxxxxx>
> ---
Acked-by: David Hildenbrand (arm) <david@xxxxxxxxxx>
--
Cheers,
David