Hi, Paul, "Paul E. McKenney" <paulmck@xxxxxxxxxxxxx> writes: > On Mon, May 27, 2019 at 04:27:14PM +0800, Huang, Ying wrote: >> From: Huang Ying <ying.huang@xxxxxxxxx> >> >> total_swapcache_pages() may race with swapper_spaces[] allocation and >> freeing. Previously, this is protected with a swapper_spaces[] >> specific RCU mechanism. To simplify the logic/code complexity, it is >> replaced with get/put_swap_device(). The code line number is reduced >> too. Although not so important, the swapoff() performance improves >> too because one synchronize_rcu() call during swapoff() is deleted. > > I am guessing that total_swapcache_pages() is not used on any > fastpaths, but must defer to others on this. Of course, if the > performance/scalability of total_swapcache_pages() is important, > benchmarking is needed. This patch is mostly about code cleanup instead of performance. That is, to make the code easier to be understand. > But where do I find get_swap_device() and put_swap_device()? I do not > see them in current mainline. They are not in mainline, but in -mm tree. I should have made it more clear. Sorry about that. Best Regards, Huang, Ying