Messages in this thread | | | Date | Fri, 9 Mar 2012 10:32:31 +0900 | From | KAMEZAWA Hiroyuki <> | Subject | Re: [PATCH v5 5/7] mm: rework reclaim_stat counters |
| |
On Thu, 08 Mar 2012 22:04:19 +0400 Konstantin Khlebnikov <khlebnikov@openvz.org> wrote:
> Currently there is two types of reclaim-stat counters: > recent_scanned (pages picked from from lru), > recent_rotated (pages putted back to active lru). > Reclaimer uses ratio recent_rotated / recent_scanned > for balancing pressure between file and anon pages. > > But if we pick page from lru we can either reclaim it or put it back to lru, thus: > recent_scanned == recent_rotated[inactive] + recent_rotated[active] + reclaimed > This can be called "The Law of Conservation of Memory" =) > > Thus recent_rotated counters for each lru list is enough, reclaimed pages can be > counted as rotatation into inactive lru. After that reclaimer can use this ratio: > recent_rotated[active] / (recent_rotated[active] + recent_rotated[inactive]) > > After this patch struct zone_reclaimer_stat has only one array: recent_rotated, > which is directly indexed by lru list index: > > before patch: > > LRU_ACTIVE_ANON -> LRU_ACTIVE_ANON : recent_scanned[ANON]++, recent_rotated[ANON]++ > LRU_INACTIVE_ANON -> LRU_ACTIVE_ANON : recent_scanned[ANON]++, recent_rotated[ANON]++ > LRU_ACTIVE_ANON -> LRU_INACTIVE_ANON : recent_scanned[ANON]++ > LRU_INACTIVE_ANON -> LRU_INACTIVE_ANON : recent_scanned[ANON]++ > > after patch: > > LRU_ACTIVE_ANON -> LRU_ACTIVE_ANON : recent_rotated[LRU_ACTIVE_ANON]++ > LRU_INACTIVE_ANON -> LRU_ACTIVE_ANON : recent_rotated[LRU_ACTIVE_ANON]++ > LRU_ACTIVE_ANON -> LRU_INACTIVE_ANON : recent_rotated[LRU_INACTIVE_ANON]++ > LRU_INACTIVE_ANON -> LRU_INACTIVE_ANON : recent_rotated[LRU_INACTIVE_ANON]++ > > recent_scanned[ANON] === recent_rotated[LRU_ACTIVE_ANON] + recent_rotated[LRU_INACTIVE_ANON] > recent_rotated[ANON] === recent_rotated[LRU_ACTIVE_ANON] > > (and the same for FILE/LRU_ACTIVE_FILE/LRU_INACTIVE_FILE) > > v5: > * resolve conflict with "memcg: fix GPF when cgroup removal races with last exit" > > Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Nice description.
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
| |