Message ID | 1445487696-21545-8-git-send-email-hannes@cmpxchg.org |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Thu, Oct 22, 2015 at 12:21:35AM -0400, Johannes Weiner wrote: ... > @@ -2437,6 +2439,10 @@ static bool shrink_zone(struct zone *zone, struct scan_control *sc, > } > } > > + vmpressure(sc->gfp_mask, memcg, > + sc->nr_scanned - scanned, > + sc->nr_reclaimed - reclaimed); > + > /* > * Direct reclaim and kswapd have to scan all memory > * cgroups to fulfill the overall scan target for the > @@ -2454,10 +2460,6 @@ static bool shrink_zone(struct zone *zone, struct scan_control *sc, > } > } while ((memcg = mem_cgroup_iter(root, memcg, &reclaim))); > > - vmpressure(sc->gfp_mask, sc->target_mem_cgroup, > - sc->nr_scanned - nr_scanned, > - sc->nr_reclaimed - nr_reclaimed); > - > if (sc->nr_reclaimed - nr_reclaimed) > reclaimable = true; > I may be mistaken, but AFAIU this patch subtly changes the behavior of vmpressure visible from the userspace: w/o this patch a userspace process will only receive a notification for a memory cgroup only if *this* memory cgroup calls reclaimer; with this patch userspace notification will be issued even if reclaimer is invoked by any cgroup up the hierarchy. Thanks, Vladimir -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu 22-10-15 00:21:35, Johannes Weiner wrote: > The vmpressure metric is based on reclaim efficiency, which in turn is > an attribute of the LRU. However, vmpressure events are currently > reported at the source of pressure rather than at the reclaim level. > > Switch the reporting to the reclaim level to allow finer-grained > analysis of which memcg is having trouble reclaiming its pages. I can see how this can be useful. > As far as memory.pressure_level interface semantics go, events are > escalated up the hierarchy until a listener is found, so this won't > affect existing users that listen at higher levels. This is true but the parent will not see cumulative events anymore. One memcg might be fighting and barely reclaim anything so it would report high pressure while other would be doing just fine. The parent will just see conflicting events in a short time period and cannot match them the source memcg. This sounds really confusing. Even more confusing than the current semantic which allows the same behavior under certain configurations. I dunno, have to think about it some more. Maybe we need to rethink the way how the pressure is signaled. If we want the breakdown of the particular memcgs then we should be able to identify them for this to be useful. [...]
diff --git a/mm/vmscan.c b/mm/vmscan.c index ecc2125..50630c8 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2404,6 +2404,7 @@ static bool shrink_zone(struct zone *zone, struct scan_control *sc, memcg = mem_cgroup_iter(root, NULL, &reclaim); do { unsigned long lru_pages; + unsigned long reclaimed; unsigned long scanned; struct lruvec *lruvec; int swappiness; @@ -2416,6 +2417,7 @@ static bool shrink_zone(struct zone *zone, struct scan_control *sc, lruvec = mem_cgroup_zone_lruvec(zone, memcg); swappiness = mem_cgroup_swappiness(memcg); + reclaimed = sc->nr_reclaimed; scanned = sc->nr_scanned; shrink_lruvec(lruvec, swappiness, sc, &lru_pages); @@ -2437,6 +2439,10 @@ static bool shrink_zone(struct zone *zone, struct scan_control *sc, } } + vmpressure(sc->gfp_mask, memcg, + sc->nr_scanned - scanned, + sc->nr_reclaimed - reclaimed); + /* * Direct reclaim and kswapd have to scan all memory * cgroups to fulfill the overall scan target for the @@ -2454,10 +2460,6 @@ static bool shrink_zone(struct zone *zone, struct scan_control *sc, } } while ((memcg = mem_cgroup_iter(root, memcg, &reclaim))); - vmpressure(sc->gfp_mask, sc->target_mem_cgroup, - sc->nr_scanned - nr_scanned, - sc->nr_reclaimed - nr_reclaimed); - if (sc->nr_reclaimed - nr_reclaimed) reclaimable = true;
The vmpressure metric is based on reclaim efficiency, which in turn is an attribute of the LRU. However, vmpressure events are currently reported at the source of pressure rather than at the reclaim level. Switch the reporting to the reclaim level to allow finer-grained analysis of which memcg is having trouble reclaiming its pages. As far as memory.pressure_level interface semantics go, events are escalated up the hierarchy until a listener is found, so this won't affect existing users that listen at higher levels. This also prepares vmpressure for hooking it up to the networking stack's memory pressure code. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> --- mm/vmscan.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)