[PATCH 4/5] mm/huge_memory: fold nested ifs in __folio_freeze_and_split_unmapped()
From: Kiryl Shutsemau
Date: Wed Aug 26 2026 - 12:25:52 EST
From: "Kiryl Shutsemau (Meta)" <kas@xxxxxxxxxx>
The two nested conditions guard a single statistics update.
Fold them into one condition and drop the braces from the
single-statement/single-line bodies.
No functional change intended.
Assisted-by: Claude-Code:claude-opus-5
Signed-off-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
---
mm/huge_memory.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 36e90756e83b..001d89c57fa2 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3955,19 +3955,14 @@ static int __folio_freeze_and_split_unmapped(struct folio *folio, unsigned int n
MTHP_STAT_NR_ANON_PARTIALLY_MAPPED, -1);
}
- if (mapping) {
+ if (mapping && folio_test_pmd_mappable(folio) &&
+ new_order < HPAGE_PMD_ORDER) {
int nr = folio_nr_pages(folio);
- if (folio_test_pmd_mappable(folio) &&
- new_order < HPAGE_PMD_ORDER) {
- if (folio_test_swapbacked(folio)) {
- lruvec_stat_mod_folio(folio,
- NR_SHMEM_THPS, -nr);
- } else {
- lruvec_stat_mod_folio(folio,
- NR_FILE_THPS, -nr);
- }
- }
+ if (folio_test_swapbacked(folio))
+ lruvec_stat_mod_folio(folio, NR_SHMEM_THPS, -nr);
+ else
+ lruvec_stat_mod_folio(folio, NR_FILE_THPS, -nr);
}
if (folio_test_swapcache(folio)) {
--
2.54.0