* [PATCH] mm: vmscan: ensure reclaiming pages on the lru lists of zone
@ 2012-01-22 3:08 Hillf Danton
2012-01-22 16:47 ` Hillf Danton
0 siblings, 1 reply; 4+ messages in thread
From: Hillf Danton @ 2012-01-22 3:08 UTC (permalink / raw)
To: linux-mm
Cc: Michal Hocko, KAMEZAWA Hiroyuki, Ying Han, Hugh Dickins,
Andrew Morton, LKML, Hillf Danton
It is possible that the memcg input into shrink_mem_cgroup_zone() in
each round is not NULL, and the loop terminates at NULL case. And there
is chance that pages on the lru lists of zone are not reclaimed.
Mem cgroup iteration is refactored a bit to ensure the NULL case is also
input into the function.
Signed-off-by: Hillf Danton <dhillf@gmail.com>
---
--- a/mm/vmscan.c Sat Jan 14 14:02:20 2012
+++ b/mm/vmscan.c Sun Jan 22 10:09:32 2012
@@ -2142,14 +2142,14 @@ static void shrink_zone(int priority, st
.zone = zone,
.priority = priority,
};
- struct mem_cgroup *memcg;
+ struct mem_cgroup_zone mz = {
+ .zone = zone,
+ };
+ struct mem_cgroup *memcg = NULL;
- memcg = mem_cgroup_iter(root, NULL, &reclaim);
do {
- struct mem_cgroup_zone mz = {
- .mem_cgroup = memcg,
- .zone = zone,
- };
+ memcg = mem_cgroup_iter(root, memcg, &reclaim);
+ mz.mem_cgroup = memcg,
shrink_mem_cgroup_zone(priority, &mz, sc);
/*
@@ -2166,7 +2166,6 @@ static void shrink_zone(int priority, st
mem_cgroup_iter_break(root, memcg);
break;
}
- memcg = mem_cgroup_iter(root, memcg, &reclaim);
} while (memcg);
}
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: vmscan: ensure reclaiming pages on the lru lists of zone
2012-01-22 3:08 [PATCH] mm: vmscan: ensure reclaiming pages on the lru lists of zone Hillf Danton
@ 2012-01-22 16:47 ` Hillf Danton
2012-01-23 11:20 ` Johannes Weiner
0 siblings, 1 reply; 4+ messages in thread
From: Hillf Danton @ 2012-01-22 16:47 UTC (permalink / raw)
To: linux-mm
Cc: Michal Hocko, KAMEZAWA Hiroyuki, Ying Han, Hugh Dickins,
Andrew Morton, LKML, Hillf Danton
Hi all
For easy review, it is re-prepared based on 3.3-rc1.
Thanks
Hillf
===cut please===
From: Hillf Danton <dhillf@gmail.com>
Subject: [PATCH] mm: vmscan: ensure reclaiming pages on the lru lists of zone
While iterating over memory cgroup hierarchy, pages are reclaimed from each
mem cgroup, and reclaim terminates after a full round-trip. It is possible
that no pages on the lru lists of given zone are reclaimed, as termination
is checked after the reclaiming function.
Mem cgroup iteration is rearranged a bit to make sure that pages are reclaimed
from both mem cgroups and zone.
Signed-off-by: Hillf Danton <dhillf@gmail.com>
---
--- a/mm/vmscan.c Mon Jan 23 00:23:10 2012
+++ b/mm/vmscan.c Mon Jan 23 00:26:44 2012
@@ -2142,14 +2142,14 @@ static void shrink_zone(int priority, st
.zone = zone,
.priority = priority,
};
- struct mem_cgroup *memcg;
+ struct mem_cgroup_zone mz = {
+ .zone = zone,
+ };
+ struct mem_cgroup *memcg = NULL;
- memcg = mem_cgroup_iter(root, NULL, &reclaim);
do {
- struct mem_cgroup_zone mz = {
- .mem_cgroup = memcg,
- .zone = zone,
- };
+ memcg = mem_cgroup_iter(root, memcg, &reclaim);
+ mz.mem_cgroup = memcg;
shrink_mem_cgroup_zone(priority, &mz, sc);
/*
@@ -2166,7 +2166,6 @@ static void shrink_zone(int priority, st
mem_cgroup_iter_break(root, memcg);
break;
}
- memcg = mem_cgroup_iter(root, memcg, &reclaim);
} while (memcg);
}
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: vmscan: ensure reclaiming pages on the lru lists of zone
2012-01-22 16:47 ` Hillf Danton
@ 2012-01-23 11:20 ` Johannes Weiner
2012-01-23 11:53 ` Hillf Danton
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Weiner @ 2012-01-23 11:20 UTC (permalink / raw)
To: Hillf Danton
Cc: linux-mm, Michal Hocko, KAMEZAWA Hiroyuki, Ying Han,
Hugh Dickins, Andrew Morton, LKML
On Mon, Jan 23, 2012 at 12:47:34AM +0800, Hillf Danton wrote:
> Hi all
>
> For easy review, it is re-prepared based on 3.3-rc1.
>
> Thanks
> Hillf
>
> ===cut please===
> From: Hillf Danton <dhillf@gmail.com>
> Subject: [PATCH] mm: vmscan: ensure reclaiming pages on the lru lists of zone
>
> While iterating over memory cgroup hierarchy, pages are reclaimed from each
> mem cgroup, and reclaim terminates after a full round-trip. It is possible
> that no pages on the lru lists of given zone are reclaimed, as termination
> is checked after the reclaiming function.
>
> Mem cgroup iteration is rearranged a bit to make sure that pages are reclaimed
> from both mem cgroups and zone.
It's not only possible, it's guaranteed: with the memory controller
enabled, the global per-zone lru lists are empty.
Pages used to be linked on the global per-zone AND the memcg per-zone
lru lists. Nowadays, they only sit on the memcg per-zone lists, which
is why global reclaim does a hierarchy walk.
The global per-zone lists are just an artifact for when the memory
controller is not available. The plan is to make root_mem_cgroup
available at all times, even without the memory controller.
So I'm afraid your patch only adds a round of scanning a known-to-be
empty lruvec. NAK.
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: vmscan: ensure reclaiming pages on the lru lists of zone
2012-01-23 11:20 ` Johannes Weiner
@ 2012-01-23 11:53 ` Hillf Danton
0 siblings, 0 replies; 4+ messages in thread
From: Hillf Danton @ 2012-01-23 11:53 UTC (permalink / raw)
To: Johannes Weiner
Cc: linux-mm, Michal Hocko, KAMEZAWA Hiroyuki, Ying Han,
Hugh Dickins, Andrew Morton, LKML
On Mon, Jan 23, 2012 at 7:20 PM, Johannes Weiner <hannes@cmpxchg.org> wrote:
> On Mon, Jan 23, 2012 at 12:47:34AM +0800, Hillf Danton wrote:
>> Hi all
>>
>> For easy review, it is re-prepared based on 3.3-rc1.
>>
>> Thanks
>> Hillf
>>
>> ===cut please===
>> From: Hillf Danton <dhillf@gmail.com>
>> Subject: [PATCH] mm: vmscan: ensure reclaiming pages on the lru lists of zone
>>
>> While iterating over memory cgroup hierarchy, pages are reclaimed from each
>> mem cgroup, and reclaim terminates after a full round-trip. It is possible
>> that no pages on the lru lists of given zone are reclaimed, as termination
>> is checked after the reclaiming function.
>>
>> Mem cgroup iteration is rearranged a bit to make sure that pages are reclaimed
>> from both mem cgroups and zone.
>
> It's not only possible, it's guaranteed: with the memory controller
> enabled, the global per-zone lru lists are empty.
>
> Pages used to be linked on the global per-zone AND the memcg per-zone
> lru lists. Nowadays, they only sit on the memcg per-zone lists, which
> is why global reclaim does a hierarchy walk.
>
Thanks for getting me up to date 8-)
Hillf
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-01-23 11:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-22 3:08 [PATCH] mm: vmscan: ensure reclaiming pages on the lru lists of zone Hillf Danton
2012-01-22 16:47 ` Hillf Danton
2012-01-23 11:20 ` Johannes Weiner
2012-01-23 11:53 ` Hillf Danton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox