mm: compaction: early termination in compact_nodes()
authorKefeng Wang <wangkefeng.wang@huawei.com>
Thu, 8 Feb 2024 02:25:08 +0000 (10:25 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 24 Feb 2024 01:48:31 +0000 (17:48 -0800)
commitf6f3f27597864d38bce5b4c346494970ecc19544
treed39fc2ebc67485f4676dd111709e303a63d40435
parent55e78c933d747ed44b2b22879e6a55e5af34b9f7
mm: compaction: early termination in compact_nodes()

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