From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CDEAC63798 for ; Fri, 27 Nov 2020 00:24:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23821221F9 for ; Fri, 27 Nov 2020 00:24:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392055AbgK0AYl (ORCPT ); Thu, 26 Nov 2020 19:24:41 -0500 Received: from mx2.suse.de ([195.135.220.15]:59514 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392053AbgK0AYk (ORCPT ); Thu, 26 Nov 2020 19:24:40 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E423FAC65; Fri, 27 Nov 2020 00:24:38 +0000 (UTC) From: NeilBrown To: Trond Myklebust , "linux-nfs@vger.kernel.org" Date: Fri, 27 Nov 2020 11:24:33 +1100 Subject: [PATCH] NFS: switch nfsiod to be an UNBOUND workqueue. In-Reply-To: <87k0uzqqn7.fsf@notabene.neil.brown.name> References: <87sg9or794.fsf@notabene.neil.brown.name> <37ec02047951a5d61cf9f9f5b4dc7151cd877772.camel@hammerspace.com> <87k0uzqqn7.fsf@notabene.neil.brown.name> cc: TJ Message-ID: <87pn3zlk8u.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable nfsiod is currently a concurrency-managed workqueue (CMWQ). This means that workitems scheduled to nfsiod on a given CPU are queued behind all other work items queued on any CMWQ on the same CPU. This can introduce unexpected latency. Occaionally nfsiod can even cause excessive latency. If the work item to complete a CLOSE request calls the final iput() on an inode, the address_space of that inode will be dismantled. This takes time proportional to the number of in-memory pages, which on a large host working on large files (e.g.. 5TB), can be a large number of pages resulting in a noticable number of seconds. We can avoid these latency problems by switching nfsiod to WQ_UNBOUND. This causes each concurrent work item to gets a dedicated thread which can be scheduled to an idle CPU. There is precedent for this as several other filesystems use WQ_UNBOUND workqueue for handling various async events. Signed-off-by: NeilBrown =2D-- fs/nfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index aa6493905bbe..43af053f467a 100644 =2D-- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -2180,7 +2180,7 @@ static int nfsiod_start(void) { struct workqueue_struct *wq; dprintk("RPC: creating workqueue nfsiod\n"); =2D wq =3D alloc_workqueue("nfsiod", WQ_MEM_RECLAIM, 0); + wq =3D alloc_workqueue("nfsiod", WQ_MEM_RECLAIM | WQ_UNBOUND, 0); if (wq =3D=3D NULL) return -ENOMEM; nfsiod_workqueue =3D wq; =2D-=20 2.29.2 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJCBAEBCAAsFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAl/AR0EOHG5laWxiQHN1 c2UuZGUACgkQOeye3VZigbliUw//XfMub60GzM3zr/mNTulcvC+bwAizfbI/9S7D V/Z7aMI8LRFQyl071M2bkymz+Qgj66JTF0hkM68KygcmP3A+pvPayhrrZkpfDUzM QNSzzYrMQtOFCepVn2qCZ0k6TFayaCqSX4ws0CP0rArUt9ZMZY7TS3GYAIyXBjQ2 1nxxChjZRpDusmKpu9X2/EM1FjCJrH6XPXQU8n3HsG1eZ+jmykhQexZCo6NQdXLP Ypsc3o03cW5Xwy2klQw5gCF9yt1LVqeqwWoRRAcv5b4LWNcmWTfvtLFG8CSeLRCz aJl7Oz1UiG1LrNFSyH2NZiJMgDdoN80KrJliIzGvOatiM33i+bHmNWHmDIO8XMr1 N3kGXmKsGtcyu1mbgvtKebfY8XVTFkUdBtzLZ6eu0gDzDksqiY9vUlp47Wgce7sO DRHlRTmMav5cf+fRvS3gfNxKmJxFoTtPZOvLi4gM1QPgsc1QMxOp9w32cKJX98xQ 97TQQOpCAvPSZM+rz0ZqUQAMlDZH5ptCNcAyPRTq6DdFYyuo4tQUWSPLJccBfLIy e8+zf9u65j8DK88v8u661WNKRB+HH5/MH572Dcr7LiFvInGwgKNXzQP2NXQGmg5s oquIsXmhwl7FO2oK5Yr6YSHnMrTnJ2VFLsdkABYO/563ZatN82vmfWhDIHzAo7WA 0w+pltc= =RkKv -----END PGP SIGNATURE----- --=-=-=--