[PATCH 3/4] mm/compaction: use compact_unlock_should_abort in isolate_migratepages_block

From: Kemeng Shi
Date: Tue Jul 18 2023 - 23:31:56 EST


Use compact_unlock_should_abort in isolate_migratepages_block to remove
repeat code.

Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
---
mm/compaction.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 638146a49e89..c1dc821ac6e1 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -909,20 +909,10 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
* contention, to give chance to IRQs. Abort completely if
* a fatal signal is pending.
*/
- if (!(low_pfn % COMPACT_CLUSTER_MAX)) {
- if (locked) {
- spin_unlock_irqrestore(locked, flags);
- locked = NULL;
- }
-
- if (fatal_signal_pending(current)) {
- cc->contended = true;
- ret = -EINTR;
-
- goto fatal_pending;
- }
-
- cond_resched();
+ if (!(low_pfn % COMPACT_CLUSTER_MAX) &&
+ compact_unlock_should_abort(&locked, flags, cc)) {
+ ret = -EINTR;
+ goto fatal_pending;
}

nr_scanned++;
--
2.30.0