All of lore.kernel.org
 help / color / mirror / Atom feed
* [to-be-updated] mm-mempolicy-simplify-weighted-interleave-bulk-alloc-calculations.patch removed from -mm tree
@ 2025-06-30 22:35 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-06-30 22:35 UTC (permalink / raw)
  To: mm-commits, ziy, ying.huang, rakie.kim, osalvador, matthew.brost,
	gourry, david, byungchul, apopple, joshua.hahnjy, akpm


The quilt patch titled
     Subject: mm/mempolicy: simplify weighted interleave bulk alloc calculations
has been removed from the -mm tree.  Its filename was
     mm-mempolicy-simplify-weighted-interleave-bulk-alloc-calculations.patch

This patch was dropped because an updated version will be issued

------------------------------------------------------
From: Joshua Hahn <joshua.hahnjy@gmail.com>
Subject: mm/mempolicy: simplify weighted interleave bulk alloc calculations
Date: Thu, 26 Jun 2025 13:09:33 -0700

Patch series "mm/mempolicy: Cleanup and optimization for weighted
interleave".

Two small patches for weighted interleave bulk allocaton.

The first patch simplifies the delta calculation needed for the allocations,
removing an if-else and performing unconditional additions instead.

The second patch makes a minor improvement to the weighted interleave bulk
allocation function by skipping a call to __alloc_pages_bulk.

Running a quick benchmark by compiling the kernel shows a small increase
in performance. These experiments were run on a machine with 2 nodes, each
with 125GB memory and 40 CPUs.

time numactl -w 0,1 make -j$(nproc)

+----------+---------+------------+---------+
| Time (s) |  6.16   | With patch | % Delta |
+----------+---------+------------+---------+
| Real     |  88.374 |    88.3356 | -0.2019 |
| User     |  3631.7 |   3636.263 |  0.0631 |
| Sys      | 366.029 |    363.792 | -0.7534 |
+----------+---------+------------+---------+


This patch (of 2):

Simplify the math used to figure out how many pages should be allocated
per node.  Instead of making conditional additions and deletions, we can
just make them unconditional by using min().  No functional changes
intended.

Link: https://lkml.kernel.org/r/20250626200936.3974420-1-joshua.hahnjy@gmail.com
Link: https://lkml.kernel.org/r/20250626200936.3974420-2-joshua.hahnjy@gmail.com
Signed-off-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Rakie Kim <rakie.kim@sk.com>
Reviewed-by: Gregory Price <gourry@gourry.net>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Byungchul Park <byungchul@sk.com>
Cc: "Huang, Ying" <ying.huang@linux.alibaba.com>
Cc: Mathew Brost <matthew.brost@intel.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/mempolicy.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

--- a/mm/mempolicy.c~mm-mempolicy-simplify-weighted-interleave-bulk-alloc-calculations
+++ a/mm/mempolicy.c
@@ -2645,18 +2645,15 @@ static unsigned long alloc_pages_bulk_we
 	for (i = 0; i < nnodes; i++) {
 		node = next_node_in(prev_node, nodes);
 		weight = weights[node];
-		node_pages = weight * rounds;
-		/* If a delta exists, add this node's portion of the delta */
-		if (delta > weight) {
-			node_pages += weight;
-			delta -= weight;
-		} else if (delta) {
-			/* when delta is depleted, resume from that node */
-			node_pages += delta;
+		/* when delta is depleted, resume from that node */
+		if (delta && delta < weight) {
 			resume_node = node;
 			resume_weight = weight - delta;
-			delta = 0;
 		}
+		/* Add the node's portion of the delta, if there is one */
+		node_pages = weight * rounds + min(delta, weight);
+		delta -= min(delta, weight);
+
 		/* node_pages can be 0 if an allocation fails and rounds == 0 */
 		if (!node_pages)
 			break;
_

Patches currently in -mm which might be from joshua.hahnjy@gmail.com are

mm-mempolicy-skip-unnecessary-synchronize_rcu.patch
mm-mempolicy-skip-extra-call-to-__alloc_pages_bulk-in-weighted-interleave.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-06-30 22:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-30 22:35 [to-be-updated] mm-mempolicy-simplify-weighted-interleave-bulk-alloc-calculations.patch removed from -mm tree Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.