The patch titled
swap: scan_swap_map latency breaks
has been added to the -mm tree. Its filename is
swap-scan_swap_map-latency-breaks.patch
Patches currently in -mm which might be from [EMAIL PROTECTED] are
swap-update-swapfile-i_sem-comment.patch
swap-correct-swapfile-nr_good_pages.patch
swap-move-destroy_swap_extents-calls.patch
swap-swap-extent-list-is-ordered.patch
swap-show-span-of-swap-extents.patch
swap-swap-unsigned-int-consistency.patch
swap-freeing-update-swap_listnext.patch
swap-get_swap_page-drop-swap_list_lock.patch
swap-scan_swap_map-restyled.patch
swap-scan_swap_map-drop-swap_device_lock.patch
swap-scan_swap_map-latency-breaks.patch
swap-swap_lock-replace-listdevice.patch
swap-update-swsusp-use-of-swap_info.patch
From: Hugh Dickins <[EMAIL PROTECTED]>
The get_swap_page/scan_swap_map latency can be so bad that even those without
preemption configured deserve relief: periodically cond_resched.
Signed-off-by: Hugh Dickins <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---
mm/swapfile.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff -puN mm/swapfile.c~swap-scan_swap_map-latency-breaks mm/swapfile.c
--- devel/mm/swapfile.c~swap-scan_swap_map-latency-breaks 2005-07-08
22:34:58.000000000 -0700
+++ devel-akpm/mm/swapfile.c 2005-07-08 22:34:58.000000000 -0700
@@ -56,8 +56,6 @@ static DECLARE_MUTEX(swapon_sem);
*/
static DECLARE_RWSEM(swap_unplug_sem);
-#define SWAPFILE_CLUSTER 256
-
void swap_unplug_io_fn(struct backing_dev_info *unused_bdi, struct page *page)
{
swp_entry_t entry;
@@ -84,9 +82,13 @@ void swap_unplug_io_fn(struct backing_de
up_read(&swap_unplug_sem);
}
+#define SWAPFILE_CLUSTER 256
+#define LATENCY_LIMIT 256
+
static inline unsigned long scan_swap_map(struct swap_info_struct *si)
{
unsigned long offset, last_in_cluster;
+ int latency_ration = LATENCY_LIMIT;
/*
* We try to cluster swap pages by allocating them sequentially
@@ -117,6 +119,10 @@ static inline unsigned long scan_swap_ma
si->cluster_next = offset-SWAPFILE_CLUSTER-1;
goto cluster;
}
+ if (unlikely(--latency_ration < 0)) {
+ cond_resched();
+ latency_ration = LATENCY_LIMIT;
+ }
}
swap_device_lock(si);
goto lowest;
@@ -153,6 +159,10 @@ checks: if (!(si->flags & SWP_WRITEOK))
swap_device_lock(si);
goto checks;
}
+ if (unlikely(--latency_ration < 0)) {
+ cond_resched();
+ latency_ration = LATENCY_LIMIT;
+ }
}
swap_device_lock(si);
goto lowest;
_
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html