From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
"kosaki.motohiro@jp.fujitsu.com" <kosaki.motohiro@jp.fujitsu.com>
Subject: [RFC][PATCH 3/4] memcg: softlimit caller via kswapd
Date: Mon, 9 Mar 2009 16:42:18 +0900 [thread overview]
Message-ID: <20090309164218.b64251b7.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20090309163745.5e3805ba.kamezawa.hiroyu@jp.fujitsu.com>
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
This patch adds hooks for memcg's softlimit to kswapd().
Softlimit handler is called...
- before generic shrink_zone() is called.
- # of pages to be scanned depends on priority.
- If not enough progress, selected memcg will be moved to UNUSED queue.
- at each call for balance_pgdat(), softlimit queue is rebalanced.
Changelog: v1->v2
- check "enough progress" or not.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
mm/vmscan.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
Index: develop/mm/vmscan.c
===================================================================
--- develop.orig/mm/vmscan.c
+++ develop/mm/vmscan.c
@@ -1733,6 +1733,43 @@ unsigned long try_to_free_mem_cgroup_pag
}
#endif
+static void shrink_zone_softlimit(struct scan_control *sc, struct zone *zone,
+ int order, int priority, int target, int end_zone)
+{
+ int scan = SWAP_CLUSTER_MAX;
+ int nid = zone->zone_pgdat->node_id;
+ int zid = zone_idx(zone);
+ int before;
+ struct mem_cgroup *mem;
+
+ scan <<= (DEF_PRIORITY - priority);
+ if (scan > (target * 2))
+ scan = target * 2;
+
+ while (scan > 0) {
+ if (zone_watermark_ok(zone, order, target, end_zone, 0))
+ break;
+ mem = mem_cgroup_schedule(nid, zid);
+ if (!mem)
+ return;
+ sc->nr_scanned = 0;
+ sc->mem_cgroup = mem;
+ before = sc->nr_reclaimed;
+ sc->isolate_pages = mem_cgroup_isolate_pages;
+
+ shrink_zone(priority, zone, sc);
+
+ if (sc->nr_reclaimed - before > scan/2)
+ mem_cgroup_schedule_end(nid, zid, mem, true);
+ else
+ mem_cgroup_schedule_end(nid, zid, mem, false);
+
+ sc->mem_cgroup = NULL;
+ sc->isolate_pages = isolate_pages_global;
+ scan -= sc->nr_scanned;
+ }
+ return;
+}
/*
* For kswapd, balance_pgdat() will work across all this node's zones until
* they are all at pages_high.
@@ -1776,6 +1813,8 @@ static unsigned long balance_pgdat(pg_da
*/
int temp_priority[MAX_NR_ZONES];
+ /* Refill softlimit queue */
+ mem_cgroup_reschedule(pgdat->node_id);
loop_again:
total_scanned = 0;
sc.nr_reclaimed = 0;
@@ -1856,6 +1895,9 @@ loop_again:
end_zone, 0))
all_zones_ok = 0;
temp_priority[i] = priority;
+ /* Try soft limit at first */
+ shrink_zone_softlimit(&sc, zone, order, priority,
+ 8 * zone->pages_high, end_zone);
sc.nr_scanned = 0;
note_zone_scanning_priority(zone, priority);
/*
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-03-09 7:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-09 7:37 [RFC][PATCH] memcg: softlimit (Another one) v3 KAMEZAWA Hiroyuki
2009-03-09 7:39 ` [RFC][PATCH 1/4] memcg: add softlimit interface and utilitiy function KAMEZAWA Hiroyuki
2009-03-09 7:44 ` Balbir Singh
2009-03-09 7:55 ` KAMEZAWA Hiroyuki
2009-03-09 8:48 ` Balbir Singh
2009-03-10 5:53 ` KAMEZAWA Hiroyuki
2009-03-10 8:03 ` Balbir Singh
2009-03-10 8:31 ` Balbir Singh
2009-03-09 8:29 ` KAMEZAWA Hiroyuki
2009-03-09 8:54 ` Balbir Singh
2009-03-09 9:07 ` KAMEZAWA Hiroyuki
2009-03-09 7:41 ` [RFC][PATCH 2/4] memcg: softlimit priority and victim scheduler KAMEZAWA Hiroyuki
2009-03-09 7:42 ` KAMEZAWA Hiroyuki [this message]
2009-03-10 19:02 ` [RFC][PATCH 3/4] memcg: softlimit caller via kswapd Balbir Singh
2009-03-10 23:52 ` KAMEZAWA Hiroyuki
2009-03-12 0:05 ` KOSAKI Motohiro
2009-03-12 0:08 ` KAMEZAWA Hiroyuki
2009-03-09 7:43 ` [RFC][PATCH 4/4] memcg: softlimit documenation KAMEZAWA Hiroyuki
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=20090309164218.b64251b7.kamezawa.hiroyu@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=balbir@linux.vnet.ibm.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=nishimura@mxp.nes.nec.co.jp \
/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