Skip to content

Commit

Permalink
mm/page_io.c: fix polled swap page in
Browse files Browse the repository at this point in the history
swap_readpage() wants to do polling to bring in pages if asked to, but
it doesn't mark the bio as being polled.  Additionally, the looping
around the blk_poll() check isn't correct - if we get a zero return, we
should call io_schedule(), we can't just assume that the bio has
completed.  The regular bio->bi_private check should be used for that.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
axboe authored and torvalds committed Jan 4, 2019
1 parent d499480 commit b685a73
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mm/page_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ int swap_readpage(struct page *page, bool synchronous)
get_task_struct(current);
bio->bi_private = current;
bio_set_op_attrs(bio, REQ_OP_READ, 0);
if (synchronous)
bio->bi_opf |= REQ_HIPRI;
count_vm_event(PSWPIN);
bio_get(bio);
qc = submit_bio(bio);
Expand All @@ -410,7 +412,7 @@ int swap_readpage(struct page *page, bool synchronous)
break;

if (!blk_poll(disk->queue, qc, true))
break;
io_schedule();
}
__set_current_state(TASK_RUNNING);
bio_put(bio);
Expand Down

0 comments on commit b685a73

Please sign in to comment.