public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mm: huge_memory: clean up defrag sysfs with shared data tables
@ 2026-03-20 16:05 Breno Leitao
  2026-03-20 16:05 ` [PATCH 1/2] mm: huge_memory: use sysfs_match_string() in defrag_store() Breno Leitao
  2026-03-20 16:05 ` [PATCH 2/2] mm: huge_memory: refactor defrag_show() to use defrag_flags[] Breno Leitao
  0 siblings, 2 replies; 12+ messages in thread
From: Breno Leitao @ 2026-03-20 16:05 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes, Zi Yan,
	Baolin Wang, Liam R. Howlett, Nico Pache, Ryan Roberts, Dev Jain,
	Barry Song, Lance Yang
  Cc: linux-mm, linux-kernel, Breno Leitao, kernel-team

Refactor defrag_store() and defrag_show() to use shared data tables
instead of duplicated if/else chains.

Patch 1 introduces an enum defrag_mode, a defrag_mode_strings[] table,
and a defrag_flags[] mapping array, then rewrites defrag_store() to use
sysfs_match_string() with a loop over defrag_flags[].

Patch 2 refactors defrag_show() to use the same arrays, replacing its
hardcoded if/else chain of test_bit() calls and string literals.

This follows the same pattern applied to anon_enabled_store() in commit
522dfb4ba71f ("mm: huge_memory: refactor anon_enabled_store() with
change_anon_orders()").

Breno Leitao (2):
  mm: huge_memory: use sysfs_match_string() in defrag_store()
  mm: huge_memory: refactor defrag_show() to use defrag_flags[]

Signed-off-by: Breno Leitao <leitao@debian.org>
---
Breno Leitao (2):
      mm: huge_memory: use sysfs_match_string() in defrag_store()
      mm: huge_memory: refactor defrag_show() to use defrag_flags[]

 mm/huge_memory.c | 98 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 56 insertions(+), 42 deletions(-)
---
base-commit: 785f0eb2f85decbe7c1ef9ae922931f0194ffc2e
change-id: 20260320-thp_defrag-540fc4f1fa3d

Best regards,
--  
Breno Leitao <leitao@debian.org>



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-04-03  6:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox