Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> writes: > On Thu, 14 Dec 2017 16:17:18 +0100 Michal Hocko <mhocko@xxxxxxxxxx> wrote: > >> > as fast as possible, SRCU instead of reference count is used to >> > implement get/put_swap_device(). From get_swap_device() to >> > put_swap_device(), the reader side of SRCU is locked, so >> > synchronize_srcu() in swapoff() will wait until put_swap_device() is >> > called. >> >> It is quite unfortunate to pull SRCU as a dependency to the core kernel. >> Different attempts to do this have failed in the past. This one is >> slightly different though because I would suspect that those tiny >> systems do not configure swap. But who knows, maybe they do. >> >> Anyway, if you are worried about performance then I would expect some >> numbers to back that worry. So why don't simply start with simpler >> ref count based and then optimize it later based on some actual numbers. >> Btw. have you considered pcp refcount framework. I would suspect that >> this would give you close to SRCU performance. > > <squeaky-wheel>Or use stop_kernel() ;)</squeaky-wheel> Although I still thought SRCU based solution is better, I will prepare a version with preempt_disable() + stop_machine() or rcu_read_lock() + synchronize_rcu() based version for people to compare between them. BTW, it appears that rcu_read_lock() + synchronize_rcu() is better than preempt_disable() + stop_machine(), why not use it? Best Regards, Huang, Ying -- 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>