From patchwork Thu Oct 26 02:26:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 10027405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 190F5601E8 for ; Thu, 26 Oct 2017 02:27:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B3C328CD0 for ; Thu, 26 Oct 2017 02:27:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 002B328CD3; Thu, 26 Oct 2017 02:27:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B31028CD0 for ; Thu, 26 Oct 2017 02:27:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932197AbdJZC0s (ORCPT ); Wed, 25 Oct 2017 22:26:48 -0400 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 X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "Cc" Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DF240AD1F; Thu, 26 Oct 2017 02:26:46 +0000 (UTC) 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 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1420,7 +1420,7 @@ static void namespace_unlock(void) if (likely(hlist_empty(&head))) return; - synchronize_rcu(); + synchronize_rcu_expedited(); group_pin_kill(&head); }