-
Alex Shi authored
The current relock logic will change lru_lock when it finds a new lruvec, so if 2 memcgs are reading a file or allocating pages at same time, they could hold the lru_lock alternately, and wait for each other for fairness attribute of ticket spin lock. This patch will sort all lru_locks and only hold them once in the above scenario. That could reduce fairness waiting for lock reacquision. vm-scalability/case-lru-file-readtwice gets a ~5% performance gain on my 2P*20core*HT machine. Testing when all or most of the pages belong to the same lruvec show no regression - most time is spent on lru_lock for lru sensitive cases. Link: https://lkml.kernel.org/r/1605860847-47445-1-git-send-email-alex.shi@linux.alibaba.com Suggested-by: Konstantin Khlebnikov <koct9i@gmail.com> Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Hugh Dickins <hughd@google.com> Cc: Yu Zhao <yuzhao@google.com> Cc: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
d4ac4d67