Please sign in to comment.
rwsem-spinlock: Implement writer lock-stealing for better scalability
We (Linux Kernel Performance project) found a regression introduced by commit: 5a50508 mm/rmap: Convert the struct anon_vma::mutex to an rwsem which converted all anon_vma::mutex locks rwsem write locks. The semantics are the same, but the behavioral difference is quite huge in some cases. After investigating it we found the root cause: mutexes support lock stealing while rwsems don't. Here is the link for the detailed regression report: https://lkml.org/lkml/2013/1/29/84 Ingo suggested adding write lock stealing to rwsems: "I think we should allow lock-steal between rwsem writers - that will not hurt fairness as most rwsem fairness concerns relate to reader vs. writer fairness" And here is the rwsem-spinlock version. With this patch, we got a double performance increase in one test box with following aim7 workfile: FILESIZE: 1M POOLSIZE: 10M 10 fork_test /usr/bin/time output w/o patch /usr/bin/time_output with patch -- Percent of CPU this job got: 369% Percent of CPU this job got: 537% Voluntary context switches: 640595016 Voluntary context switches: 157915561 We got a 45% increase in CPU usage and saved about 3/4 voluntary context switches. Reported-by: LKP project <email@example.com> Suggested-by: Ingo Molnar <firstname.lastname@example.org> Signed-off-by: Yuanhan Liu <email@example.com> Cc: Alex Shi <firstname.lastname@example.org> Cc: David Howells <email@example.com> Cc: Michel Lespinasse <firstname.lastname@example.org> Cc: Linus Torvalds <email@example.com> Cc: Andrew Morton <firstname.lastname@example.org> Cc: Peter Zijlstra <email@example.com> Cc: Anton Blanchard <firstname.lastname@example.org> Cc: Arjan van de Ven <email@example.com> Cc: firstname.lastname@example.org Link: http://email@example.com Signed-off-by: Ingo Molnar <firstname.lastname@example.org>
- Loading branch information...