summaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-01-25 22:11:17 +0100
committerTakashi Iwai <tiwai@suse.de>2017-01-25 22:11:17 +0100
commite1a063f43a5e0435ecf8a2b6d42e10e20e8caf61 (patch)
tree7329fb15e57917a503c859f7266fcd034728bd54 /mm/swapfile.c
parent9eb5d0e635ebe2f227d591e531d48c6f01c0dd78 (diff)
parent0369d6315bc2bc56da2a2b15c8074b889096a47e (diff)
downloadop-kernel-dev-e1a063f43a5e0435ecf8a2b6d42e10e20e8caf61.zip
op-kernel-dev-e1a063f43a5e0435ecf8a2b6d42e10e20e8caf61.tar.gz
Merge branch 'topic/intel-lpe-audio' into for-next
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 1c6e032..4761701 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -943,11 +943,25 @@ bool reuse_swap_page(struct page *page, int *total_mapcount)
count = page_trans_huge_mapcount(page, total_mapcount);
if (count <= 1 && PageSwapCache(page)) {
count += page_swapcount(page);
- if (count == 1 && !PageWriteback(page)) {
+ if (count != 1)
+ goto out;
+ if (!PageWriteback(page)) {
delete_from_swap_cache(page);
SetPageDirty(page);
+ } else {
+ swp_entry_t entry;
+ struct swap_info_struct *p;
+
+ entry.val = page_private(page);
+ p = swap_info_get(entry);
+ if (p->flags & SWP_STABLE_WRITES) {
+ spin_unlock(&p->lock);
+ return false;
+ }
+ spin_unlock(&p->lock);
}
}
+out:
return count <= 1;
}
@@ -2448,6 +2462,10 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
error = -ENOMEM;
goto bad_swap;
}
+
+ if (bdi_cap_stable_pages_required(inode_to_bdi(inode)))
+ p->flags |= SWP_STABLE_WRITES;
+
if (p->bdev && blk_queue_nonrot(bdev_get_queue(p->bdev))) {
int cpu;
OpenPOWER on IntegriCloud