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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D596FC77B62 for ; Wed, 22 Mar 2023 08:33:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230150AbjCVIdE (ORCPT ); Wed, 22 Mar 2023 04:33:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbjCVIdC (ORCPT ); Wed, 22 Mar 2023 04:33:02 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC1B9136E6 for ; Wed, 22 Mar 2023 01:33:01 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 5957E67373; Wed, 22 Mar 2023 09:32:58 +0100 (CET) Date: Wed, 22 Mar 2023 09:32:58 +0100 From: Christoph Hellwig To: Qu Wenruo Cc: Christoph Hellwig , Chris Mason , Josef Bacik , David Sterba , Johannes Thumshirn , linux-btrfs@vger.kernel.org Subject: Re: [PATCH 03/10] btrfs: offload all write I/O completions to a workqueue Message-ID: <20230322083258.GA23315@lst.de> References: <20230314165910.373347-1-hch@lst.de> <20230314165910.373347-4-hch@lst.de> <2aa047a7-984e-8f6f-163e-8fe6d12a41d8@gmx.com> <20230320123059.GB9008@lst.de> <20230321125550.GB10470@lst.de> <5eebb0fc-0be3-c313-27cd-4e11a7b04405@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5eebb0fc-0be3-c313-27cd-4e11a7b04405@gmx.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Wed, Mar 22, 2023 at 07:37:07AM +0800, Qu Wenruo wrote: >> If you limit max_active to a certain value, you clearly tell the >> workqueue code not not use more workers that that. That is what the >> argument is for. > > And if a work load can only be deadlock free using the default max_active, > but not any value smaller, then I'd say the work load itself is buggy. Anything that has an interaction between two instances of a work_struct can deadlock. Only a single execution context is guaranteed (and even that only with WQ_MEM_RECLAIM), and we've seen plenty of deadlocks due to e.g. only using a global workqueue in file systems or block devices that can stack. Fortunately these days lockdep is generally able to catch these dependencies as well. > The usecase is still there. > To limit the amount of CPU time spent by btrfs workloads, from csum > verification to compression. So this is the first time I see an actual explanation, thanks for that first. If this is the reason we should apply the max_active to all workqueus that do csum an compression work, but not to other random workqueues. Dave, Josef, Chis: do you agree to this interpretation?