summaryrefslogtreecommitdiffstats
path: root/include/linux/swap.h
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2005-09-03 15:54:41 -0700
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 00:05:42 -0700
commit5d337b9194b1ce3b6fd5f3cb2799455ed2f9a3d1 (patch)
tree91ed9ef6f4cb5f6a1832f2baaaabd53fcd83513e /include/linux/swap.h
parent048c27fd72816b44e096997d1c6901c3abbfd45b (diff)
downloadop-kernel-dev-5d337b9194b1ce3b6fd5f3cb2799455ed2f9a3d1.zip
op-kernel-dev-5d337b9194b1ce3b6fd5f3cb2799455ed2f9a3d1.tar.gz
[PATCH] swap: swap_lock replace list+device
The idea of a swap_device_lock per device, and a swap_list_lock over them all, is appealing; but in practice almost every holder of swap_device_lock must already hold swap_list_lock, which defeats the purpose of the split. The only exceptions have been swap_duplicate, valid_swaphandles and an untrodden path in try_to_unuse (plus a few places added in this series). valid_swaphandles doesn't show up high in profiles, but swap_duplicate does demand attention. However, with the hold time in get_swap_pages so much reduced, I've not yet found a load and set of swap device priorities to show even swap_duplicate benefitting from the split. Certainly the split is mere overhead in the common case of a single swap device. So, replace swap_list_lock and swap_device_lock by spinlock_t swap_lock (generally we seem to prefer an _ in the name, and not hide in a macro). If someone can show a regression in swap_duplicate, then probably we should add a hashlock for the swap_map entries alone (shorts being anatomic), so as to help the case of the single swap device too. Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/swap.h')
-rw-r--r--include/linux/swap.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h
index db3b5de..3c9ff00 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -121,7 +121,7 @@ enum {
*/
struct swap_info_struct {
unsigned int flags;
- spinlock_t sdev_lock;
+ int prio; /* swap priority */
struct file *swap_file;
struct block_device *bdev;
struct list_head extent_list;
@@ -135,7 +135,6 @@ struct swap_info_struct {
unsigned int pages;
unsigned int max;
unsigned int inuse_pages;
- int prio; /* swap priority */
int next; /* next entry on swap list */
};
@@ -221,13 +220,7 @@ extern int can_share_swap_page(struct page *);
extern int remove_exclusive_swap_page(struct page *);
struct backing_dev_info;
-extern struct swap_list_t swap_list;
-extern spinlock_t swaplock;
-
-#define swap_list_lock() spin_lock(&swaplock)
-#define swap_list_unlock() spin_unlock(&swaplock)
-#define swap_device_lock(p) spin_lock(&p->sdev_lock)
-#define swap_device_unlock(p) spin_unlock(&p->sdev_lock)
+extern spinlock_t swap_lock;
/* linux/mm/thrash.c */
extern struct mm_struct * swap_token_mm;
OpenPOWER on IntegriCloud