Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1539685

[PATCH v4 8/9] mm/swap: Enable swap slots cache usage

From Tim Chen <tim.c.chen@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH v4 8/9] mm/swap: Enable swap slots cache usage
Date 2016-12-09 22:20 +0100
Message-ID <sMAKe-8id-37@gated-at.bofh.it> (permalink)
References <sMAAx-8eJ-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
---
 mm/swapfile.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 3a6cad1..2440cec 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2184,6 +2184,8 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
 	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();
@@ -2191,9 +2193,12 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
 	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);
@@ -2871,6 +2876,8 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
 		putname(name);
 	if (inode && S_ISREG(inode->i_mode))
 		inode_unlock(inode);
+	if (!error)
+		enable_swap_slots_cache();
 	return error;
 }
 
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 0/9] mm/swap: Regular page swap optimizations  Tim Chen <tim.c.chen@linux.intel.com> - 2016-12-09 22:20 +0100
  [PATCH v4 4/9] mm/swap: skip read ahead for unreferenced swap slots Tim Chen <tim.c.chen@linux.intel.com> - 2016-12-09 22:20 +0100
  [PATCH v4 8/9] mm/swap: Enable swap slots cache usage Tim Chen <tim.c.chen@linux.intel.com> - 2016-12-09 22:20 +0100
  [PATCH v4 7/9] mm/swap: Add cache for swap slots allocation Tim Chen <tim.c.chen@linux.intel.com> - 2016-12-09 22:20 +0100
  Re: [PATCH v4 0/9] mm/swap: Regular page swap optimizations Minchan Kim <minchan@kernel.org> - 2016-12-27 08:50 +0100
    Re: [PATCH v4 0/9] mm/swap: Regular page swap optimizations "Huang\, Ying" <ying.huang@intel.com> - 2016-12-28 03:00 +0100
      Re: [PATCH v4 0/9] mm/swap: Regular page swap optimizations Minchan Kim <minchan@kernel.org> - 2016-12-28 03:40 +0100
        Re: [PATCH v4 0/9] mm/swap: Regular page swap optimizations "Huang\, Ying" <ying.huang@intel.com> - 2016-12-28 04:20 +0100
          Re: [PATCH v4 0/9] mm/swap: Regular page swap optimizations "Huang\, Ying" <ying.huang@intel.com> - 2016-12-28 04:40 +0100
            Re: [PATCH v4 0/9] mm/swap: Regular page swap optimizations Minchan Kim <minchan@kernel.org> - 2016-12-28 05:10 +0100
              Re: [PATCH v4 0/9] mm/swap: Regular page swap optimizations "Huang\, Ying" <ying.huang@intel.com> - 2016-12-28 06:00 +0100
    Re: [PATCH v4 0/9] mm/swap: Regular page swap optimizations Jan Kara <jack@suse.cz> - 2017-01-02 16:50 +0100
      Re: [PATCH v4 0/9] mm/swap: Regular page swap optimizations Minchan Kim <minchan@kernel.org> - 2017-01-03 05:40 +0100
        Re: [PATCH v4 0/9] mm/swap: Regular page swap optimizations "Huang\, Ying" <ying.huang@intel.com> - 2017-01-03 06:50 +0100

csiph-web