On Tue, Jan 10, 2017 at 01:55:51PM +0100, Michal Hocko wrote: > From: Michal Hocko <mhocko@xxxxxxxx> > > get_scan_count considers the whole node LRU size when > - doing SCAN_FILE due to many page cache inactive pages > - calculating the number of pages to scan > > in both cases this might lead to unexpected behavior especially on 32b > systems where we can expect lowmem memory pressure very often. The amount of retrofitting zones back into reclaim is disappointing :/ > /* > + * Return the number of pages on the given lru which are eligible for the > + * given zone_idx > + */ > +static unsigned long lruvec_lru_size_eligibe_zones(struct lruvec *lruvec, > + enum lru_list lru, int zone_idx) > +{ > + struct pglist_data *pgdat = lruvec_pgdat(lruvec); > + unsigned long lru_size; > + int zid; > + > + lru_size = lruvec_lru_size(lruvec, lru); > + for (zid = zone_idx + 1; zid < MAX_NR_ZONES; zid++) { > + struct zone *zone = &pgdat->node_zones[zid]; > + unsigned long size; > + > + if (!managed_zone(zone)) > + continue; > + > + size = lruvec_zone_lru_size(lruvec, lru, zid); > + lru_size -= min(size, lru_size); > + } > + > + return lru_size; The only other use of lruvec_lru_size() is also in get_scan_count(), where it decays the LRU pressure balancing ratios. That caller wants to operate on the entire lruvec. Can you instead add the filtering logic to lruvec_lru_size() directly, and pass MAX_NR_ZONES when operating on the entire lruvec? That would make the code quite a bit clearer than having 3 different lruvec size querying functions. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>