Re: [PATCH v2 1/2] mm: huge_memory: refactor thpsize_shmem_enabled_store() with sysfs_match_string()

From: ranxiaokai627

Date: Wed May 20 2026 - 06:36:19 EST


>On Thu, 14 May 2026 09:26:39 +0000 ranxiaokai627@xxxxxxx wrote:
>
>> Thanks for the detailed and thoughtful review! I'll fix this as
>> suggested in the next version.
>
>AI review is asking about a couple of atomicity issues - please check it out?
> https://sashiko.dev/#/patchset/20260513094508.50888-1-ranxiaokai627@xxxxxxx

The huge_shmem_orders_xxx global variables are of type unsigned long,
which is 32-bit even on 32-bit systems. There is no reason for the
store in __test_and_set_bit() to be split into two instructions,
so I do not think this introduces a torn write issue.

David also mentioned this optimization here:
https://lore.kernel.org/all/4f2abf42-983f-4cc2-92f5-c81827e7b7e2@xxxxxxxxxx/