diff options
-rw-r--r-- | mm/swap_state.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/swap_state.c b/mm/swap_state.c index 4c5ff7f284d9..c85b5590cccd 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/pagemap.h> | 15 | #include <linux/pagemap.h> |
16 | #include <linux/backing-dev.h> | 16 | #include <linux/backing-dev.h> |
17 | #include <linux/blkdev.h> | ||
17 | #include <linux/pagevec.h> | 18 | #include <linux/pagevec.h> |
18 | #include <linux/migrate.h> | 19 | #include <linux/migrate.h> |
19 | #include <linux/page_cgroup.h> | 20 | #include <linux/page_cgroup.h> |
@@ -376,6 +377,7 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask, | |||
376 | unsigned long offset = swp_offset(entry); | 377 | unsigned long offset = swp_offset(entry); |
377 | unsigned long start_offset, end_offset; | 378 | unsigned long start_offset, end_offset; |
378 | unsigned long mask = (1UL << page_cluster) - 1; | 379 | unsigned long mask = (1UL << page_cluster) - 1; |
380 | struct blk_plug plug; | ||
379 | 381 | ||
380 | /* Read a page_cluster sized and aligned cluster around offset. */ | 382 | /* Read a page_cluster sized and aligned cluster around offset. */ |
381 | start_offset = offset & ~mask; | 383 | start_offset = offset & ~mask; |
@@ -383,6 +385,7 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask, | |||
383 | if (!start_offset) /* First page is swap header. */ | 385 | if (!start_offset) /* First page is swap header. */ |
384 | start_offset++; | 386 | start_offset++; |
385 | 387 | ||
388 | blk_start_plug(&plug); | ||
386 | for (offset = start_offset; offset <= end_offset ; offset++) { | 389 | for (offset = start_offset; offset <= end_offset ; offset++) { |
387 | /* Ok, do the async read-ahead now */ | 390 | /* Ok, do the async read-ahead now */ |
388 | page = read_swap_cache_async(swp_entry(swp_type(entry), offset), | 391 | page = read_swap_cache_async(swp_entry(swp_type(entry), offset), |
@@ -391,6 +394,8 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask, | |||
391 | continue; | 394 | continue; |
392 | page_cache_release(page); | 395 | page_cache_release(page); |
393 | } | 396 | } |
397 | blk_finish_plug(&plug); | ||
398 | |||
394 | lru_add_drain(); /* Push any new pages onto the LRU now */ | 399 | lru_add_drain(); /* Push any new pages onto the LRU now */ |
395 | return read_swap_cache_async(entry, gfp_mask, vma, addr); | 400 | return read_swap_cache_async(entry, gfp_mask, vma, addr); |
396 | } | 401 | } |