diff options
author | Shaohua Li <shli@kernel.org> | 2013-02-22 19:34:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 20:50:17 -0500 |
commit | 33806f06da654092182410d974b6d3c5396ea3eb (patch) | |
tree | 7f7da99d94481a1d4c78ebf05b410fc8ba654a39 /mm/util.c | |
parent | 9800339b5e0f0e24ab3dac349e0de80d2018832e (diff) |
swap: make each swap partition have one address_space
When I use several fast SSD to do swap, swapper_space.tree_lock is
heavily contended. This makes each swap partition have one
address_space to reduce the lock contention. There is an array of
address_space for swap. The swap entry type is the index to the array.
In my test with 3 SSD, this increases the swapout throughput 20%.
[akpm@linux-foundation.org: revert unneeded change to __add_to_swap_cache]
Signed-off-by: Shaohua Li <shli@fusionio.com>
Cc: Hugh Dickins <hughd@google.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/util.c')
-rw-r--r-- | mm/util.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
7 | #include <linux/security.h> | 7 | #include <linux/security.h> |
8 | #include <linux/swap.h> | 8 | #include <linux/swap.h> |
9 | #include <linux/swapops.h> | ||
9 | #include <asm/uaccess.h> | 10 | #include <asm/uaccess.h> |
10 | 11 | ||
11 | #include "internal.h" | 12 | #include "internal.h" |
@@ -389,9 +390,12 @@ struct address_space *page_mapping(struct page *page) | |||
389 | 390 | ||
390 | VM_BUG_ON(PageSlab(page)); | 391 | VM_BUG_ON(PageSlab(page)); |
391 | #ifdef CONFIG_SWAP | 392 | #ifdef CONFIG_SWAP |
392 | if (unlikely(PageSwapCache(page))) | 393 | if (unlikely(PageSwapCache(page))) { |
393 | mapping = &swapper_space; | 394 | swp_entry_t entry; |
394 | else | 395 | |
396 | entry.val = page_private(page); | ||
397 | mapping = swap_address_space(entry); | ||
398 | } else | ||
395 | #endif | 399 | #endif |
396 | if ((unsigned long)mapping & PAGE_MAPPING_ANON) | 400 | if ((unsigned long)mapping & PAGE_MAPPING_ANON) |
397 | mapping = NULL; | 401 | mapping = NULL; |