Skip to contentSkip to conversation

mm-page_alloc-scale-the-number-of-pages-that-are-batch-allocated.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Oct 25, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm, page_alloc: scale the number of pages that are batch allocated
has been removed from the -mm tree. Its filename was
mm-page_alloc-scale-the-number-of-pages-that-are-batch-allocated.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: Huang Ying <[email protected]>
Subject: mm, page_alloc: scale the number of pages that are batch allocated
Date: Mon, 16 Oct 2023 13:29:58 +0800

When a task is allocating a large number of order-0 pages, it may acquire the zone->lock multiple times allocating pages in batches. This may unnecessarily contend on the zone lock when allocating very large number of pages. This patch adapts the size of the batch based on the recent pattern to scale the batch size for subsequent allocations.

On a 2-socket Intel server with 224 logical CPU, we run 8 kbuild instances in parallel (each with make -j 28) in 8 cgroup. This simulates the kbuild server that is used by 0-Day kbuild service. With the patch, the cycles% of the spinlock contention (mostly for zone lock) decreases from 12.6% to 11.0% (with PCP size == 367).

Cc Vlastimil Babka <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Pavel Tatashin <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Sudeep Holla <[email protected]>

---

 include/linux/mmzone.h |    3 +-
 mm/page_alloc.c        |   53 +++++++++++++++++++++++++++++++--------
 2 files changed, 45 insertions(+), 11 deletions(-)
include/linux/mmzone.h renamed from include/linux/mmzone.h~mm-page_alloc-scale-the-number-of-pages-that-are-batch-allocated +2 -1
@@ -695,9 +695,10 @@ struct per_cpu_pages {
 	int high;		/* high watermark, emptying needed */
 	int batch;		/* chunk size for buddy add/remove */
 	u8 flags;		/* protected by pcp->lock */
+	u8 alloc_factor;	/* batch scaling factor during allocate */
 	u8 free_factor;		/* batch scaling factor during free */
 #ifdef CONFIG_NUMA
-	short expire;		/* When 0, remote pagesets are drained */
+	u8 expire;		/* When 0, remote pagesets are drained */
 #endif
 
 	/* Lists of pages, one per migrate type stored on the pcp-lists */
mm/page_alloc.c renamed from mm/page_alloc.c~mm-page_alloc-scale-the-number-of-pages-that-are-batch-allocated +43 -10

73 lines not on this page · raw message

_

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