From: Konstantin Khlebnikov <khlebnikov@openvz.org>
To: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Mel Gorman <mgorman@suse.de>
Subject: [PATCH 1/2] mm: provide zone vmstat percpu drift bounds
Date: Wed, 07 Dec 2011 19:16:41 +0300 [thread overview]
Message-ID: <20111207151641.30334.84106.stgit@zurg> (raw)
vmstat use per-cpu counters for accounting, so atomic part on struct zone has some drift.
Free-pages watermark logic has some protection against this innacuracy.
too-many-isolated checks has the same problem. This patch provides drift bounds for them.
Plus this patch reset zone->percpu_drift_mark if drift protection is no longer required,
this can happens after memory hotplug.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
---
include/linux/mmzone.h | 3 +++
mm/vmstat.c | 6 +++++-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 188cb2f..401438d 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -307,6 +307,9 @@ struct zone {
*/
unsigned long percpu_drift_mark;
+ /* Maximum vm_stat per-cpu counters drift */
+ unsigned long percpu_drift;
+
/*
* We don't know if the memory that we're going to allocate will be freeable
* or/and it will be released eventually, so to avoid totally wasting several
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 8fd603b..94540e1 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -172,16 +172,20 @@ void refresh_zone_stat_thresholds(void)
per_cpu_ptr(zone->pageset, cpu)->stat_threshold
= threshold;
+ max_drift = num_online_cpus() * threshold;
+ zone->percpu_drift = max_drift;
+
/*
* Only set percpu_drift_mark if there is a danger that
* NR_FREE_PAGES reports the low watermark is ok when in fact
* the min watermark could be breached by an allocation
*/
tolerate_drift = low_wmark_pages(zone) - min_wmark_pages(zone);
- max_drift = num_online_cpus() * threshold;
if (max_drift > tolerate_drift)
zone->percpu_drift_mark = high_wmark_pages(zone) +
max_drift;
+ else
+ zone->percpu_drift_mark = 0;
}
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2011-12-07 15:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 16:16 Konstantin Khlebnikov [this message]
2011-12-07 16:16 ` [PATCH 2/2] mm: fix endless looping around false-positive too_many_isolated() Konstantin Khlebnikov
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=20111207151641.30334.84106.stgit@zurg \
--to=khlebnikov@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).