The patch titled Subject: mm: vmscan: simplify lruvec_lru_size() has been added to the -mm tree. Its filename is mm-vmscan-simplify-lruvec_lru_size.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-vmscan-simplify-lruvec_lru_size.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-vmscan-simplify-lruvec_lru_size.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Johannes Weiner <hannes@xxxxxxxxxxx> Subject: mm: vmscan: simplify lruvec_lru_size() Patch series "mm: vmscan: cgroup-related cleanups". Here are 8 patches that clean up the reclaim code's interaction with cgroups a bit. They're not supposed to change any behavior, just make the implementation easier to understand and work with. This patch (of 8): This function currently takes the node or lruvec size and subtracts the zones that are excluded by the classzone index of the allocation. It uses four different types of counters to do this. Just add up the eligible zones. Link: http://lkml.kernel.org/r/20191022144803.302233-2-hannes@xxxxxxxxxxx Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx> Reviewed-by: Roman Gushchin <guro@xxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/vmscan.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) --- a/mm/vmscan.c~mm-vmscan-simplify-lruvec_lru_size +++ a/mm/vmscan.c @@ -351,32 +351,21 @@ unsigned long zone_reclaimable_pages(str */ unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx) { - unsigned long lru_size = 0; + unsigned long size = 0; int zid; - if (!mem_cgroup_disabled()) { - for (zid = 0; zid < MAX_NR_ZONES; zid++) - lru_size += mem_cgroup_get_zone_lru_size(lruvec, lru, zid); - } else - lru_size = node_page_state(lruvec_pgdat(lruvec), NR_LRU_BASE + lru); - - for (zid = zone_idx + 1; zid < MAX_NR_ZONES; zid++) { + for (zid = 0; zid <= zone_idx; zid++) { struct zone *zone = &lruvec_pgdat(lruvec)->node_zones[zid]; - unsigned long size; if (!managed_zone(zone)) continue; if (!mem_cgroup_disabled()) - size = mem_cgroup_get_zone_lru_size(lruvec, lru, zid); + size += mem_cgroup_get_zone_lru_size(lruvec, lru, zid); else - size = zone_page_state(&lruvec_pgdat(lruvec)->node_zones[zid], - NR_ZONE_LRU_BASE + lru); - lru_size -= min(size, lru_size); + size += zone_page_state(zone, NR_ZONE_LRU_BASE + lru); } - - return lru_size; - + return size; } /* _ Patches currently in -mm which might be from hannes@xxxxxxxxxxx are mm-rate-limit-allocation-failure-warnings-more-aggressively.patch mm-memcontrol-fix-network-errors-from-failing-__gfp_atomic-charges.patch mm-memcontrol-remove-dead-code-from-memory_max_write.patch mm-memcontrol-try-harder-to-set-a-new-memoryhigh.patch mm-drop-mmap_sem-before-calling-balance_dirty_pages-in-write-fault.patch mm-vmscan-simplify-lruvec_lru_size.patch mm-clean-up-and-clarify-lruvec-lookup-procedure.patch mm-vmscan-move-inactive_list_is_low-swap-check-to-the-caller.patch mm-vmscan-naming-fixes-global_reclaim-and-sane_reclaim.patch mm-vmscan-replace-shrink_node-loop-with-a-retry-jump.patch mm-vmscan-turn-shrink_node_memcg-into-shrink_lruvec.patch mm-vmscan-split-shrink_node-into-node-part-and-memcgs-part.patch mm-vmscan-split-shrink_node-into-node-part-and-memcgs-part-fix.patch mm-vmscan-harmonize-writeback-congestion-tracking-for-nodes-memcgs.patch