Commit b685a735 authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

mm/page_io.c: fix polled swap page in

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/e15243a8-2cdf-c32c-ecee-f289377c8ef9@kernel.dkSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d499480c
...@@ -401,6 +401,8 @@ int swap_readpage(struct page *page, bool synchronous) ...@@ -401,6 +401,8 @@ int swap_readpage(struct page *page, bool synchronous)
get_task_struct(current); get_task_struct(current);
bio->bi_private = current; bio->bi_private = current;
bio_set_op_attrs(bio, REQ_OP_READ, 0); bio_set_op_attrs(bio, REQ_OP_READ, 0);
if (synchronous)
bio->bi_opf |= REQ_HIPRI;
count_vm_event(PSWPIN); count_vm_event(PSWPIN);
bio_get(bio); bio_get(bio);
qc = submit_bio(bio); qc = submit_bio(bio);
...@@ -410,7 +412,7 @@ int swap_readpage(struct page *page, bool synchronous) ...@@ -410,7 +412,7 @@ int swap_readpage(struct page *page, bool synchronous)
break; break;
if (!blk_poll(disk->queue, qc, true)) if (!blk_poll(disk->queue, qc, true))
break; io_schedule();
} }
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
bio_put(bio); bio_put(bio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment