File tree 1 file changed +7
-0
lines changed 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 22
22
#include <linux/frontswap.h>
23
23
#include <linux/blkdev.h>
24
24
#include <linux/uio.h>
25
+ #include <linux/sched/task.h>
25
26
#include <asm/pgtable.h>
26
27
27
28
static struct bio * get_swap_bio (gfp_t gfp_flags ,
@@ -136,6 +137,7 @@ static void end_swap_bio_read(struct bio *bio)
136
137
WRITE_ONCE (bio -> bi_private , NULL );
137
138
bio_put (bio );
138
139
wake_up_process (waiter );
140
+ put_task_struct (waiter );
139
141
}
140
142
141
143
int generic_swapfile_activate (struct swap_info_struct * sis ,
@@ -378,6 +380,11 @@ int swap_readpage(struct page *page, bool do_poll)
378
380
goto out ;
379
381
}
380
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
388
bio -> bi_private = current ;
382
389
bio_set_op_attrs (bio , REQ_OP_READ , 0 );
383
390
count_vm_event (PSWPIN );
You can’t perform that action at this time.
0 commit comments