On Tue, 23 May 2017 10:23:23 -0400 Josef Bacik <josef@xxxxxxxxxxxxxx> wrote: > When testing a slab heavy workload I noticed that we often would barely > reclaim anything at all from slab when kswapd started doing reclaim. > This is because we use the ratio of nr_scanned / nr_lru to determine how > much of slab we should reclaim. But in a slab only/mostly workload we > will not have much page cache to reclaim, and thus our ratio will be > really low and not at all related to where the memory on the system is. > Instead we want to use a ratio of the reclaimable slab to the actual > reclaimable space on the system. That way if we are slab heavy we work > harder to reclaim slab. > > The other part of this that hurts is when we are running close to full > memory with our working set. If we start putting a lot of reclaimable > slab pressure on the system (think find /, or some other silliness), we > will happily evict the active pages over the slab cache. This is kind > of backwards as we want to do all that we can to keep the active working > set in memory, and instead evict these short lived objects. The same > thing occurs when say you do a yum update of a few packages while your > working set takes up most of RAM, you end up with inactive lists being > relatively small and so we reclaim active pages even though we could > reclaim these short lived inactive pages. > > My approach here is twofold. First, keep track of the difference in > inactive and slab pages since the last time kswapd ran. In the first > run this will just be the overall counts of inactive and slab, but for > each subsequent run we'll have a good idea of where the memory pressure > is coming from. Then we use this information to put pressure on either > the inactive lists or the slab caches, depending on where the pressure > is coming from. > > ... > hm, that's a pretty big change. I took it, but it will require quite some reviewing and testing to get further, please. -- 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>