On Mon, Mar 15, 2021 at 09:13:50AM +0800, Hillf Danton wrote: > On Sat, 13 Mar 2021 00:57:33 -0700 Yu Zhao wrote: > > TLDR > > ==== > > The current page reclaim is too expensive in terms of CPU usage and > > often making poor choices about what to evict. We would like to offer > > a performant, versatile and straightforward augment. > > It makes my day, Monday of thick smog in one of the far east big > cities, to read the fresh work, something like 0b0695f2b34a that removed > heuristics as much as possible, of a coming Mr. Kswapd. Hi Hillf! Sorry to hear about the smog, we don't have smog, only a few feet of snow... I shared the latest version of the cover letter here, if you are a fan of Google Docs: https://docs.google.com/document/d/1UxcpPAFNk1KpTJDKDXWekj_n6ebpQ-cwbXZlYoebTVM And speaking of heuristics, yeah, I totally understand. We've had more than fair share of problems with get_scan_count() and inactive_is_low(). And we are still carrying a workaround (admittedly a terrible one) we posted more that a decade ago, on some of our old kernel versions: https://lore.kernel.org/linux-mm/20101028191523.GA14972@xxxxxxxxxx/ And people who run the Chrome browser but don't have this patch (non- Chrome OS) had problems! https://lore.kernel.org/linux-mm/54C77086.7090505@xxxxxxx/ With generation numbers, the equivalent to inactive_is_low() is max_seq - min(min_seq[!swappiness], min_seq[1]) + 1 > MIN_NR_GENS in get_nr_to_scan(); and the equivalent to get_scan_count() is *file = !swappiness || min_seq[0] > min_seq[1] || (min_seq[0] == min_seq[1] && max(lruvec->evictable.isolated[0], 1UL) * (200 - swappiness) > max(lruvec->evictable.isolated[1], 1UL) * (swappiness - 1)); in isolate_lru_gen_pages(), both in the 10th patch. They work amazingly well for us, and hopefully for you too :)