On Wed 22-02-17 15:16:57, Johannes Weiner wrote: [...] > Can we simply count the number of balance_pgdat() runs that didn't > reclaim anything and have kswapd sleep after MAX_RECLAIM_RETRIES? > > And a follow-up: once it gives up, when should kswapd return to work? > We used to reset NR_PAGES_SCANNED whenever a page gets freed. But > that's a branch in a common allocator path, just to recover kswapd - a > latency tool, not a necessity for functional correctness - from a > situation that's exceedingly pretty rare. How about we leave it > disabled until a direct reclaimer manages to free something? Yes, this makes sense to me and it looks much better than the proposed solution here. There some theoretical corner cases, like heavy metadata and GFP_NOFS workload which wouldn't be able to reclaim from FS shrinkers and kspwad would be really helpful at that time. But that would need a general solution on its own. I also welcome removing NR_PAGES_SCANNED, because this was just too ephemeral to be actually useful when debugging the reclaim behavior. I think we can accomplish much more by existing tracepoints. I would just split that up in a separate follow up patch. Thanks! -- Michal Hocko SUSE Labs -- 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>