aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_io.c
diff options
context:
space:
mode:
authorLinus Torvalds <[email protected]>2019-07-05 02:39:56 +0000
committerLinus Torvalds <[email protected]>2019-07-05 02:39:56 +0000
commita5fff14a0c7989fbc8316a43f52aed1804f02ddd (patch)
treed8d4ef6c808868f7d42b6b44cc27b871a22d460a /mm/page_io.c
parentMerge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc... (diff)
parentswap_readpage(): avoid blk_wake_io_task() if !synchronous (diff)
downloadkernel-a5fff14a0c7989fbc8316a43f52aed1804f02ddd.tar.gz
kernel-a5fff14a0c7989fbc8316a43f52aed1804f02ddd.zip
Merge branch 'akpm' (patches from Andrew)
Merge more fixes from Andrew Morton: "5 fixes" * emailed patches from Andrew Morton <[email protected]>: swap_readpage(): avoid blk_wake_io_task() if !synchronous devres: allow const resource arguments mm/vmscan.c: prevent useless kswapd loops fs/userfaultfd.c: disable irqs for fault_pending and event locks mm/page_alloc.c: fix regression with deferred struct page init
Diffstat (limited to 'mm/page_io.c')
-rw-r--r--mm/page_io.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/mm/page_io.c b/mm/page_io.c
index 189415852077..a39aac2f8c8d 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -137,8 +137,10 @@ out:
unlock_page(page);
WRITE_ONCE(bio->bi_private, NULL);
bio_put(bio);
- blk_wake_io_task(waiter);
- put_task_struct(waiter);
+ if (waiter) {
+ blk_wake_io_task(waiter);
+ put_task_struct(waiter);
+ }
}
int generic_swapfile_activate(struct swap_info_struct *sis,
@@ -395,11 +397,12 @@ int swap_readpage(struct page *page, bool synchronous)
* Keep this task valid during swap readpage because the oom killer may
* attempt to access it in the page fault retry time check.
*/
- get_task_struct(current);
- bio->bi_private = current;
bio_set_op_attrs(bio, REQ_OP_READ, 0);
- if (synchronous)
+ if (synchronous) {
bio->bi_opf |= REQ_HIPRI;
+ get_task_struct(current);
+ bio->bi_private = current;
+ }
count_vm_event(PSWPIN);
bio_get(bio);
qc = submit_bio(bio);