Skip to contentSkip to conversation

mm-huge_memory-prevent-thp_zero_page_alloc-increased-twice.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Oct 3, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/huge_memory: prevent THP_ZERO_PAGE_ALLOC increased twice
has been removed from the -mm tree. Its filename was
mm-huge_memory-prevent-thp_zero_page_alloc-increased-twice.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Liu Shixin <[email protected]>
Subject: mm/huge_memory: prevent THP_ZERO_PAGE_ALLOC increased twice
Date: Fri, 9 Sep 2022 10:16:53 +0800

A user who reads THP_ZERO_PAGE_ALLOC may be more concerned about the huge zero pages that are really allocated for thp. It is misleading to increase THP_ZERO_PAGE_ALLOC twice if two threads call get_huge_zero_page concurrently. Don't increase the value if the huge page is not really used.

Update Documentation/admin-guide/mm/transhuge.rst to suit.

Cc Alexander Potapenko <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Kefeng Wang <[email protected]>
Cc "Kirill A. Shutemov" <[email protected]>
Cc Mike Kravetz <[email protected]>

---

 Documentation/admin-guide/mm/transhuge.rst |    7 +++----
 mm/huge_memory.c                           |    2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)
Documentation/admin-guide/mm/transhuge.rst renamed from Documentation/admin-guide/mm/transhuge.rst~mm-huge_memory-prevent-thp_zero_page_alloc-increased-twice +3 -4
@@ -366,10 +366,9 @@ thp_split_pmd
 	page table entry.
 
 thp_zero_page_alloc
-	is incremented every time a huge zero page is
-	successfully allocated. It includes allocations which where
-	dropped due race with other allocation. Note, it doesn't count
-	every map of the huge zero page, only its allocation.
+	is incremented every time a huge zero page used for thp is
+	successfully allocated. Note, it doesn't count every map of
+	the huge zero page, only its allocation.
 
 thp_zero_page_alloc_failed
 	is incremented if kernel fails to allocate
mm/huge_memory.c renamed from mm/huge_memory.c~mm-huge_memory-prevent-thp_zero_page_alloc-increased-twice +1 -1
@@ -163,7 +163,6 @@ retry:
 		count_vm_event(THP_ZERO_PAGE_ALLOC_FAILED);
 		return false;
 	}
-	count_vm_event(THP_ZERO_PAGE_ALLOC);
 	preempt_disable();
 	if (cmpxchg(&huge_zero_page, NULL, zero_page)) {
 		preempt_enable();
@@ -175,6 +174,7 @@ retry:
 	/* We take additional reference here. It will be put back by shrinker */
 	atomic_set(&huge_zero_refcount, 2);
 	preempt_enable();
+	count_vm_event(THP_ZERO_PAGE_ALLOC);
 	return true;
 }
 

_

Patches currently in -mm which might be from [email protected] are