diff options
author | Minchan Kim <minchan@kernel.org> | 2017-11-15 20:33:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-15 21:21:02 -0500 |
commit | 0bcac06f27d7528591c27ac2b093ccd71c5d0168 (patch) | |
tree | b8261d05b232e57a58a7fe90306cad5d545de900 /mm/swapfile.c | |
parent | 539a6fea7fdcade532bd3e77be2862a683f8f0c9 (diff) |
mm, swap: skip swapcache for swapin of synchronous device
With fast swap storage, the platforms want to use swap more aggressively
and swap-in is crucial to application latency.
The rw_page() based synchronous devices like zram, pmem and btt are such
fast storage. When I profile swapin performance with zram lz4
decompress test, S/W overhead is more than 70%. Maybe, it would be
bigger in nvdimm.
This patch aims to reduce swap-in latency by skipping swapcache if the
swap device is synchronous device like rw_page based device. It
enhances 45% my swapin test(5G sequential swapin, no readahead, from
2.41sec to 1.64sec).
Link: http://lkml.kernel.org/r/1505886205-9671-5-git-send-email-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Huang Ying <ying.huang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r-- | mm/swapfile.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index cb08fa65819f..85aff8a42801 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -3455,10 +3455,15 @@ int swapcache_prepare(swp_entry_t entry) | |||
3455 | return __swap_duplicate(entry, SWAP_HAS_CACHE); | 3455 | return __swap_duplicate(entry, SWAP_HAS_CACHE); |
3456 | } | 3456 | } |
3457 | 3457 | ||
3458 | struct swap_info_struct *swp_swap_info(swp_entry_t entry) | ||
3459 | { | ||
3460 | return swap_info[swp_type(entry)]; | ||
3461 | } | ||
3462 | |||
3458 | struct swap_info_struct *page_swap_info(struct page *page) | 3463 | struct swap_info_struct *page_swap_info(struct page *page) |
3459 | { | 3464 | { |
3460 | swp_entry_t swap = { .val = page_private(page) }; | 3465 | swp_entry_t entry = { .val = page_private(page) }; |
3461 | return swap_info[swp_type(swap)]; | 3466 | return swp_swap_info(entry); |
3462 | } | 3467 | } |
3463 | 3468 | ||
3464 | /* | 3469 | /* |
@@ -3466,7 +3471,6 @@ struct swap_info_struct *page_swap_info(struct page *page) | |||
3466 | */ | 3471 | */ |
3467 | struct address_space *__page_file_mapping(struct page *page) | 3472 | struct address_space *__page_file_mapping(struct page *page) |
3468 | { | 3473 | { |
3469 | VM_BUG_ON_PAGE(!PageSwapCache(page), page); | ||
3470 | return page_swap_info(page)->swap_file->f_mapping; | 3474 | return page_swap_info(page)->swap_file->f_mapping; |
3471 | } | 3475 | } |
3472 | EXPORT_SYMBOL_GPL(__page_file_mapping); | 3476 | EXPORT_SYMBOL_GPL(__page_file_mapping); |
@@ -3474,7 +3478,6 @@ EXPORT_SYMBOL_GPL(__page_file_mapping); | |||
3474 | pgoff_t __page_file_index(struct page *page) | 3478 | pgoff_t __page_file_index(struct page *page) |
3475 | { | 3479 | { |
3476 | swp_entry_t swap = { .val = page_private(page) }; | 3480 | swp_entry_t swap = { .val = page_private(page) }; |
3477 | VM_BUG_ON_PAGE(!PageSwapCache(page), page); | ||
3478 | return swp_offset(swap); | 3481 | return swp_offset(swap); |
3479 | } | 3482 | } |
3480 | EXPORT_SYMBOL_GPL(__page_file_index); | 3483 | EXPORT_SYMBOL_GPL(__page_file_index); |