public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Lance Yang <lance.yang@linux.dev>
To: Breno Leitao <leitao@debian.org>
Cc: linux-mm@kvack.org, Nico Pache <npache@redhat.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Zi Yan <ziy@nvidia.com>, Ryan Roberts <ryan.roberts@arm.com>,
	David Hildenbrand <david@kernel.org>,
	Barry Song <baohua@kernel.org>,
	linux-kernel@vger.kernel.org, kernel-team@meta.com,
	Lorenzo Stoakes <ljs@kernel.org>, Dev Jain <dev.jain@arm.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/2] mm: huge_memory: use sysfs_match_string() in defrag_store()
Date: Fri, 3 Apr 2026 13:09:05 +0800	[thread overview]
Message-ID: <0be813e8-1117-48c1-aeba-c584cda9aa31@linux.dev> (raw)
In-Reply-To: <20260320-thp_defrag-v1-1-6ab15d0d26eb@debian.org>



On 2026/3/21 00:05, Breno Leitao wrote:
> Replace the if/else chain of sysfs_streq() calls in defrag_store()
> with sysfs_match_string() and a defrag_mode_strings[] table.
> 
> Introduce enum defrag_mode and defrag_flags[] array mapping each mode
> to its corresponding transparent_hugepage_flag. The store function now
> loops over defrag_flags[], setting the bit for the selected mode and
> clearing the others. When mode is DEFRAG_NEVER (index 4), no index
> in the 4-element defrag_flags[] matches, so all flags are cleared.
> 
> Note that the enum ordering (always, defer, defer+madvise, madvise,
> never) differs from the original if/else chain order in defrag_store()
> (always, defer+madvise, defer, madvise, never). This is intentional to
> match the display order used by defrag_show().
> 
> This is a follow-up cleanup to commit 522dfb4ba71f ("mm: huge_memory:
> refactor anon_enabled_store() with change_anon_orders()") which applied
> the same sysfs_match_string() pattern to anon_enabled_store().
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---

Thanks.

Tested-by: Lance Yang <lance.yang@linux.dev>

With David's comments addressed, feel free to add:

Reviewed-by: Lance Yang <lance.yang@linux.dev>

Cheers,
Lance


  parent reply	other threads:[~2026-04-03  5:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20 16:05 [PATCH 0/2] mm: huge_memory: clean up defrag sysfs with shared data tables Breno Leitao
2026-03-20 16:05 ` [PATCH 1/2] mm: huge_memory: use sysfs_match_string() in defrag_store() Breno Leitao
2026-04-02  8:21   ` David Hildenbrand (Arm)
2026-04-02 13:42     ` Breno Leitao
2026-04-02 13:45       ` David Hildenbrand (Arm)
2026-04-02 14:37         ` Breno Leitao
2026-04-03  5:09   ` Lance Yang [this message]
2026-04-03  6:46   ` Barry Song
2026-03-20 16:05 ` [PATCH 2/2] mm: huge_memory: refactor defrag_show() to use defrag_flags[] Breno Leitao
2026-04-02  8:24   ` David Hildenbrand (Arm)
2026-04-03  5:12   ` Lance Yang
2026-04-03  6:56   ` Barry Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0be813e8-1117-48c1-aeba-c584cda9aa31@linux.dev \
    --to=lance.yang@linux.dev \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=npache@redhat.com \
    --cc=ryan.roberts@arm.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox