Re: [PATCH 1/2] mm: huge_memory: use sysfs_match_string() in defrag_store()
From: David Hildenbrand (Arm)
Date: Thu Apr 02 2026 - 09:46:16 EST
On 4/2/26 15:42, Breno Leitao wrote:
> On Thu, Apr 02, 2026 at 10:21:30AM +0200, David Hildenbrand (Arm) wrote:
>> On 3/20/26 17:05, Breno Leitao wrote:
>>> +enum defrag_mode {
>>> + DEFRAG_ALWAYS = 0,
>>> + DEFRAG_DEFER = 1,
>>> + DEFRAG_DEFER_MADVISE = 2,
>>> + DEFRAG_MADVISE = 3,
>>> + DEFRAG_NEVER = 4,
>>> +};
>>
>> These numbers should get assigned as default (C standard) I think, and
>> can be dropped.
>
> You're correct that they would be assigned by default. However, I've
> explicitly set them to clarify that we iterate over these enum values
> using an integer and require these specific values.
>
> This was discussed in the previous patch series:
>
> https://lore.kernel.org/all/20260308140530.9ab6d1445d0936467eab4aef@xxxxxxxxxxxxxxxxxxxx/
>
> Please let me know if it should be removed here, and I will update the
> patch,
It's ok to leave it. It's just ... unnecessary :)
What I saw in the past is that we highlight it by only setting the "= 0"
on the first entry.
--
Cheers,
David