On Wed, 21 Mar 2018, Andrey Ryabinin wrote: > > Is SWAP_CLUSTER_MAX the best answer if I'm lowering the limit by 1GB? > > > > Absolutely not. I completely on your side here. > I've tried to fix this recently - http://lkml.kernel.org/r/20180119132544.19569-2-aryabinin@xxxxxxxxxxxxx > I guess that Andrew decided to not take my patch, because Michal wasn't > happy about it (see mail archives if you want more details). > I unfortunately didn't see this patch in January, it seems very similar to what I was suggesting in this thread. You do a page_counter_read() directly in mem_cgroup_resize_limit() where my suggestion was to have page_counter_limit() return the difference, but there's nothing significantly different about what you proposed and what I suggested. Perhaps the patch would be better off as a compromise between what you, I, and Li RongQing have proposed/suggested: have page_counter_limit() return the difference, and clamp it to some value proportional to the new limit.