* [merged mm-stable] mm-compaction-early-termination-in-compact_nodes.patch removed from -mm tree
@ 2024-02-24 1:50 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2024-02-24 1:50 UTC (permalink / raw)
To: mm-commits, david, wangkefeng.wang, akpm
The quilt patch titled
Subject: mm: compaction: early termination in compact_nodes()
has been removed from the -mm tree. Its filename was
mm-compaction-early-termination-in-compact_nodes.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: Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: mm: compaction: early termination in compact_nodes()
Date: Thu, 8 Feb 2024 10:25:08 +0800
No need to continue try compact memory if pending fatal signal, allow loop
termination earlier in compact_nodes().
The existing fatal_signal_pending() check does make compact_zone()
break out of the while loop, but it still enters the next zone/next
nid, and some unnecessary functions(eg, lru_add_drain) are called.
There was no observable benefit from the new test, it is just found
from code inspection when refactoring compact_node().
Link: https://lkml.kernel.org/r/20240208022508.1771534-1-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/compaction.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
--- a/mm/compaction.c~mm-compaction-early-termination-in-compact_nodes
+++ a/mm/compaction.c
@@ -2808,7 +2808,7 @@ enum compact_result try_to_compact_pages
* reaching score targets due to various back-off conditions, such as,
* contention on per-node or per-zone locks.
*/
-static void compact_node(pg_data_t *pgdat, bool proactive)
+static int compact_node(pg_data_t *pgdat, bool proactive)
{
int zoneid;
struct zone *zone;
@@ -2826,6 +2826,9 @@ static void compact_node(pg_data_t *pgda
if (!populated_zone(zone))
continue;
+ if (fatal_signal_pending(current))
+ return -EINTR;
+
cc.zone = zone;
compact_zone(&cc, NULL);
@@ -2837,18 +2840,25 @@ static void compact_node(pg_data_t *pgda
cc.total_free_scanned);
}
}
+
+ return 0;
}
/* Compact all zones of all nodes in the system */
-static void compact_nodes(void)
+static int compact_nodes(void)
{
- int nid;
+ int ret, nid;
/* Flush pending updates to the LRU lists */
lru_add_drain_all();
- for_each_online_node(nid)
- compact_node(NODE_DATA(nid), false);
+ for_each_online_node(nid) {
+ ret = compact_node(NODE_DATA(nid), false);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
}
static int compaction_proactiveness_sysctl_handler(struct ctl_table *table, int write,
@@ -2894,9 +2904,9 @@ static int sysctl_compaction_handler(str
return -EINVAL;
if (write)
- compact_nodes();
+ ret = compact_nodes();
- return 0;
+ return ret;
}
#if defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
_
Patches currently in -mm which might be from wangkefeng.wang@huawei.com are
zram-zcomp-remove-zcomp_set_max_streams-declaration.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-24 1:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-24 1:50 [merged mm-stable] mm-compaction-early-termination-in-compact_nodes.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.