Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8644809rwb; Thu, 24 Nov 2022 02:19:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf5bUf18JRA9i/OJou4ajlTv3ahpb0LsubFXlbFMCZEBYaUnKk1zsOJ02fCBcZ4M6tOuIkan X-Received: by 2002:a63:ec50:0:b0:476:df9e:e792 with SMTP id r16-20020a63ec50000000b00476df9ee792mr14334323pgj.210.1669285176247; Thu, 24 Nov 2022 02:19:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669285176; cv=none; d=google.com; s=arc-20160816; b=sl9nhfT/AbEV9v83DDS4QywNK5Lvu00Wn3G+qElnme/fj8g2Q26Ep5COQ9xsShgWZW afvtykMJaa2mNlVeAp9qIGQP8FsOv6+4JwwfiGUBFCbz70S3adcPnUcr3kjWCpAIja7I rMYxVxrSItUz/FfYBxzoxn/FWTzgNefyr/5Uokw1xxNQB0maCsgmVPrZpH8yYuNLaAVe 2uk/2DtsrL3C03IeQnl/k0suknilS83LkQQEmzVkVElskUrVSmM2Z0UxhLzbj60ytsd4 pBu64RVhi8GWuQ1+SVeXMEItXupLFRmX/YTZNhiWcgVOkMr79RGEU0jtYyq/7C8hMs5R bYZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=capoMoyAoTRj+QhymNjy9DjDy54aOgbbJqtTNS98/nQ=; b=s3jTWIPZkBi5Zm9ZfgoXdr6FlDNwISG5z8iCZuS9d8cZu1n7LCGlQRzJft+tXU+VBC ayj9hJkd/zuHLF40ZtCSkxmrL/PNrN/TMu6AFcmkrOu3k4m+kg6t1Q3iaI4TfBH6k7uw nJ9A6JAVUyP/xC+7Qk+BKIlJRs7IS+Qa6wCAgSXK91PIIF12xCBny+nB2XIE+yGxjoCA yb+uhjNV0QpAxl7+pJdv8nzzOvDTYpfSBT3iyz7tNDMi5D8b9+ZmjXS13Hp1/At722tR hW7HGzI/47I+QhCE+lgRUKPR9LCYMy6TG9RYMlCpSb1vDof7LIK+asTayVyQIfMYf01P eVRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ucw.cz header.s=gen1 header.b=apDGjOxr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ucw.cz Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020a170902ba8900b001853ad3944dsi555071pls.480.2022.11.24.02.19.25; Thu, 24 Nov 2022 02:19:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ucw.cz header.s=gen1 header.b=apDGjOxr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ucw.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbiKXKGU (ORCPT + 87 others); Thu, 24 Nov 2022 05:06:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229653AbiKXKGR (ORCPT ); Thu, 24 Nov 2022 05:06:17 -0500 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A12531B9F9; Thu, 24 Nov 2022 02:06:16 -0800 (PST) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id D5B641C09DB; Thu, 24 Nov 2022 11:06:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1669284374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=capoMoyAoTRj+QhymNjy9DjDy54aOgbbJqtTNS98/nQ=; b=apDGjOxrfVjgw3aF/04OkmIsnhtrCyjo6MrJ4rcit4SWicJfR1qXNVdIuE6asqhticv22R M+VmZTXsmk7cSwRVDVSlbmb2xXp1Td3LXsEkJpqnka+yXADMcqikuw2OuYNZNWBDy/WNeW VVjbKXbc45uomNEG2UQd2yoHFVcLJxw= Date: Thu, 24 Nov 2022 11:06:14 +0100 From: Pavel Machek To: Yu Kuai Cc: Eric Blake , kernel list , josef@toxicpanda.com, linux-block@vger.kernel.org, nbd@other.debian.org, "yukuai (C)" Subject: Re: nbd: please don't spawn 16 threads when nbd is not even in use Message-ID: References: <20221123200845.cuct5euvikqksojm@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HZjYMFTE2RCR7pyM" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --HZjYMFTE2RCR7pyM Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu 2022-11-24 09:17:51, Yu Kuai wrote: > Hi, >=20 > =E5=9C=A8 2022/11/24 6:01, Pavel Machek =E5=86=99=E9=81=93: > > Hi! > >=20 > > > > I see this... and it looks like there are 16 workqueues before nbd = is > > > > even used. Surely there are better ways to do that? > > >=20 > > > Yes, it would be nice to create a pool of workers that only spawns up > > > threads when actual parallel requests are made. Are you willing to > > > help write the patch? > >=20 > > I was thinking more "only spawn a workqueue when nbd is opened" or so. > >=20 > > I have 16 of them, and I'm not using nbd. Workqueue per open device is > > okay, current situation... not so much. >=20 > You can take a look at this commit: >=20 > e2daec488c57 ("nbd: Fix hungtask when nbd_config_put") >=20 > Allocation of recv_workq is moved from start device to alloc device to > fix hungtask. You might need to be careful if you want to move this. Can we get that reverted? That is rather obscure bug (how many GFP_KERNEL failures do you normally see?) and it costs, dunno, 100KB? of unswappable memory. Best regards, Pavel --=20 People of Russia, stop Putin before his war on Ukraine escalates. --HZjYMFTE2RCR7pyM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCY39CFgAKCRAw5/Bqldv6 8vWYAJ9yQ6drFnNpEutVeHvEesUcP4FckgCgvgMVBq1JANQNm02eRF+IlRzW0uc= =IyCl -----END PGP SIGNATURE----- --HZjYMFTE2RCR7pyM--