Skip to contentSkip to conversation

mm/swap: enable swap slots cache usage

PATCH New [email protected] 1 participant 1 message Feb 22, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 119/142 mm/swap: enable swap slots cache usage

From: Tim Chen <[email protected]>
Subject: mm/swap: enable swap slots cache usage

Initialize swap slots cache and enable it on swap on. Drain all swap slots on swap off.

Cc "Huang, Ying" <[email protected]>
Cc Aaron Lu <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Hillf Danton <[email protected]>
Cc Huang Ying <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Jonathan Corbet <[email protected]> escreveu:
Cc Kirill A. Shutemov <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Shaohua Li <[email protected]>
Cc Vladimir Davydov <[email protected]>

---

 mm/swapfile.c |    7 +++++++
 1 file changed, 7 insertions(+)
mm/swapfile.c renamed from mm/swapfile.c~mm-swap-enable-swap-slots-cache-usage +7 -0
diff -puN mm/swapfile.c~mm-swap-enable-swap-slots-cache-usage mm/swapfile.c
@@ -2190,6 +2190,8 @@ SYSCALL_DEFINE1(swapoff, const char __us
 	spin_unlock(&p->lock);
 	spin_unlock(&swap_lock);
 
+	disable_swap_slots_cache_lock();
+
 	set_current_oom_origin();
 	err = try_to_unuse(p->type, false, 0); /* force unuse all pages */
 	clear_current_oom_origin();
@@ -2197,9 +2199,12 @@ SYSCALL_DEFINE1(swapoff, const char __us
 	if (err) {
 		/* re-insert swap space back into swap_list */
 		reinsert_swap_info(p);
+		reenable_swap_slots_cache_unlock();
 		goto out_dput;
 	}
 
+	reenable_swap_slots_cache_unlock();
+
 	flush_work(&p->discard_work);
 
 	destroy_swap_extents(p);
@@ -2886,6 +2891,8 @@ out:
 		putname(name);
 	if (inode && S_ISREG(inode->i_mode))
 		inode_unlock(inode);
+	if (!error)
+		enable_swap_slots_cache();
 	return error;
 }
 

_