From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:58503 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751973AbdJZC0s (ORCPT ); Wed, 25 Oct 2017 22:26:48 -0400 From: NeilBrown To: Alexander Viro Date: Thu, 26 Oct 2017 13:26:37 +1100 Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Paul E. McKenney" , Josh Triplett Subject: [PATCH] VFS: use synchronize_rcu_expedited() in namespace_unlock() Message-ID: <87y3nyd4pu.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable The synchronize_rcu() in namespace_unlock() is called every time a filesystem is unmounted. If a great many filesystems are mounted, this can cause a noticable slow-down in, for example, system shutdown. The sequence: mkdir -p /tmp/Mtest/{0..5000} time for i in /tmp/Mtest/*; do mount -t tmpfs tmpfs $i ; done time umount /tmp/Mtest/* on a 4-cpu VM can report 8 seconds to mount the tmpfs filesystems, and 100 seconds to unmount them. Boot the same VM with 1 CPU and it takes 18 seconds to mount the tmpfs filesystems, but only 36 to unmount. If we change the synchronize_rcu() to synchronize_rcu_expedited() the umount time on a 4-cpu VM is 8 seconds to mount and 0.6 to unmount. I think this 200-fold speed up is worth the slightly higher system impact of use synchronize_rcu_expedited(). Signed-off-by: NeilBrown =2D-- Cc: to Paul and Josh in case they'll correct me if using _expedited() is really bad here. Thanks, NeilBrown fs/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/namespace.c b/fs/namespace.c index 3b601f115b6c..fce91c447fab 100644 =2D-- a/fs/namespace.c +++ b/fs/namespace.c @@ -1420,7 +1420,7 @@ static void namespace_unlock(void) if (likely(hlist_empty(&head))) return; =20 =2D synchronize_rcu(); + synchronize_rcu_expedited(); =20 group_pin_kill(&head); } =2D-=20 2.14.0.rc0.dirty --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAlnxR98ACgkQOeye3VZi gblYvxAAtjDs4ZOx/r6kYPpegIzL8WMhMUPpO8BdDd4gMn1/CSVVOXq26J1bJ7oH oJb7mcFAceJpQMOpuEHTKDEWm5B5p2D8J4eHjotwN4S5tZCpIN1ZA2178Ej5Ql6x KoZZFr2mdUHOpO3TukA0blawihylt8RpsxtwsfGd2cZ77a5PasW0lSJwfstsDMiB fMXaNrzU9bYw3J/X80ckv/TsNlCn3Xvu/yPOA5RQqRkwAReOYj2m7I3jWN7AXrB/ n87iaXjivA07wSSZvACWTnn6ohk2nlzH1lwzQdjuTihSh6sYJO7L1JmBniWlK1EE 4yZdmo80gZY92CU6zOGCak70JBQ4LKmujPlip/ID5u62YE1jaNpjKcTLpZOujerE +N6CrJyfWj6giQRV09bVeHNKCCHH+flHbstW8kdsFhQlA8gj/P+6cYPlEBJeSYqw B3kJfhIZkyiee+SWDuto+sYdTnnappEjvggCzu8t0M6UkDX+zjWk1eRuC4bRewPQ P50GLUrCg08okXz6I2NacJWIGCGGu3T+stdJhm59cCxOYbcQr8tXwJNkekYw+mvq fGRfIjDg234IAMEwOlf3QChVOeQgUCQQnPMpbG8Rwky2dPpA2kJpEUU2BtqZ3qWT YMua1SAKuuQONlye6RMeEYB2EgVFA9UaCU2L4ZfTvvBoQRAZhpI= =WZBY -----END PGP SIGNATURE----- --=-=-=--