diff options
Diffstat (limited to 'mm/page_io.c')
-rw-r--r-- | mm/page_io.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/page_io.c b/mm/page_io.c index b6c4ac388209..5f61b54ee1f3 100644 --- a/mm/page_io.c +++ b/mm/page_io.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/frontswap.h> | 22 | #include <linux/frontswap.h> |
23 | #include <linux/blkdev.h> | 23 | #include <linux/blkdev.h> |
24 | #include <linux/uio.h> | 24 | #include <linux/uio.h> |
25 | #include <linux/sched/task.h> | ||
25 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
26 | 27 | ||
27 | static struct bio *get_swap_bio(gfp_t gfp_flags, | 28 | static struct bio *get_swap_bio(gfp_t gfp_flags, |
@@ -136,6 +137,7 @@ out: | |||
136 | WRITE_ONCE(bio->bi_private, NULL); | 137 | WRITE_ONCE(bio->bi_private, NULL); |
137 | bio_put(bio); | 138 | bio_put(bio); |
138 | wake_up_process(waiter); | 139 | wake_up_process(waiter); |
140 | put_task_struct(waiter); | ||
139 | } | 141 | } |
140 | 142 | ||
141 | int generic_swapfile_activate(struct swap_info_struct *sis, | 143 | int generic_swapfile_activate(struct swap_info_struct *sis, |
@@ -378,6 +380,11 @@ int swap_readpage(struct page *page, bool do_poll) | |||
378 | goto out; | 380 | goto out; |
379 | } | 381 | } |
380 | bdev = bio->bi_bdev; | 382 | bdev = bio->bi_bdev; |
383 | /* | ||
384 | * Keep this task valid during swap readpage because the oom killer may | ||
385 | * attempt to access it in the page fault retry time check. | ||
386 | */ | ||
387 | get_task_struct(current); | ||
381 | bio->bi_private = current; | 388 | bio->bi_private = current; |
382 | bio_set_op_attrs(bio, REQ_OP_READ, 0); | 389 | bio_set_op_attrs(bio, REQ_OP_READ, 0); |
383 | count_vm_event(PSWPIN); | 390 | count_vm_event(PSWPIN); |