From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 11/13] scan_swap_map latency breaks
Date: Sat, 9 Jul 2005 01:10:17 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.61.0507090109410.13391@goblin.wat.veritas.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0507090057340.13391@goblin.wat.veritas.com>
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 <hugh@veritas.com>
---
mm/swapfile.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
--- swap10/mm/swapfile.c 2005-07-08 19:15:20.000000000 +0100
+++ swap11/mm/swapfile.c 2005-07-08 19:15:33.000000000 +0100
@@ -54,8 +54,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;
@@ -82,9 +80,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
@@ -115,6 +117,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;
@@ -151,6 +157,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;
next prev parent reply other threads:[~2005-07-09 0:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-09 0:00 [PATCH 00/13] some swapfile patches Hugh Dickins
2005-07-09 0:01 ` [PATCH 01/13] update swapfile i_sem comment Hugh Dickins
2005-07-09 0:01 ` [PATCH 02/13] correct swapfile nr_good_pages Hugh Dickins
2005-07-09 0:02 ` [PATCH 03/13] move destroy_swap_extents calls Hugh Dickins
2005-07-09 0:03 ` [PATCH 04/13] swap extent list is ordered Hugh Dickins
2005-07-09 0:04 ` [PATCH 05/13] show span of swap extents Hugh Dickins
2005-07-09 0:05 ` [PATCH 06/13] swap unsigned int consistency Hugh Dickins
2005-07-09 0:06 ` [PATCH 07/13] freeing update swap_list.next Hugh Dickins
2005-07-09 0:07 ` [PATCH 08/13] get_swap_page drop swap_list_lock Hugh Dickins
2005-07-09 0:08 ` [PATCH 09/13] scan_swap_map restyled Hugh Dickins
2005-07-09 0:09 ` [PATCH 10/13] scan_swap_map drop swap_device_lock Hugh Dickins
2005-07-09 0:10 ` Hugh Dickins [this message]
2005-07-09 0:11 ` [PATCH 12/13] swap_lock replace list+device Hugh Dickins
2005-07-09 0:15 ` [PATCH 13/13] update swsusp use of swap_info Hugh Dickins
2005-07-09 11:13 ` [PATCH 14/13] swsusp mod needed parentheses Hugh Dickins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.61.0507090109410.13391@goblin.wat.veritas.com \
--to=hugh@veritas.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®