Skip to contentSkip to conversation

swapfile: call cond_resched() before locking si->lock

PATCH Applied Guillaume Morin 2 participants 2 messages Aug 12 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 swapfile: call cond_resched() before locking si->lock

The 6.12 backport of commit 66366d291f66 ("mm/swap: add cond_resched() in swap_reclaim_full_clusters to prevent softlockup"), added a cond_resched() after locking si->lock. Move cond_resched() before spin_lock().

Fixes 60cbe67d1342 ("mm/swap: add cond_resched() in swap_reclaim_full_clusters to prevent softlockup")
Cc Chris Li <[email protected]>
Cc Zijiang Huang <[email protected]>
---
 mm/swapfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/swapfile.c +1 -1
index 552df432c37f..ed0a5ed25e65 100644
@@ -770,11 +770,11 @@ static void swap_reclaim_full_clusters(struct swap_info_struct *si, bool force)
 			}
 			offset++;
 		}
+		cond_resched();
 		spin_lock(&si->lock);
 
 		if (to_scan <= 0)
 			break;
-		cond_resched();
 	}
 }
 
Signature · 5 lines
2.39.1


-- 
Guillaume Morin <[email protected]>
maintainer Applied
#1 lore raw
Quoted 4 lines · Guillaume Morin

The 6.12 backport of commit 66366d291f66 ("mm/swap: add cond_resched() in swap_reclaim_full_clusters to prevent softlockup"), added a cond_resched() after locking si->lock. Move cond_resched() before spin_lock().

Queued for 6.12, thanks.

Signature · 2 lines
Thanks,
Sasha