Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3226244pxb; Mon, 9 Nov 2020 06:04:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4R+jZ9e66c10jdmeEN6QL6YVTjcM9XVO3gLmIYanAHxD81xEHnPgWiHhSuptCawMKZQiI X-Received: by 2002:a17:906:c193:: with SMTP id g19mr15814651ejz.393.1604930662313; Mon, 09 Nov 2020 06:04:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604930662; cv=none; d=google.com; s=arc-20160816; b=XbawUjV/2I5GHQurH82NlOaqLjyL6Cn4Jy4w6DAoMjBkDZI13XyE2eqjrSvlt080JJ m/4ZMVRWFxqAQo+3ysRBUYp2y8JMTsi9G7jFuCNijDxp4att3HY4x9Pbg8vbrdqnwhe9 Oo6j5Hixe9YCeW1MBLUYHPTf+jHzMv9+ZtAQu3/4egwwNpH0B8DAXaNNEVeOrFxtjs96 Zt+iQEEYxE3DnZB6YIT4w/KbKI/SJ8gnfYPkoekPBEwJrHOmVgc/v77N906SEWN5SSYw Oop38zqQ6pzHOHqJU5wmE0fkKeGLr0V/NFT2a9vrT0+VZrzFRN+Y3UVJVQO9ujzL7H1h xhOg== 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:sender:dkim-signature; bh=/ruVSjDZDRurayBLmYyYR2veA1e5iE10q7XYnooMQvs=; b=tii3xeDwtadPr/pwbNYNjSDFxnBVLP0O45A8jmHM0bZXHDwkvFHEJTxIQ0FmrhK3Dx b7pFtqeXaUh2vBcGDwE8Iv9f/aTPOTt9UsfIMQkMcJmaXDFt3xLupi/pv1aTIN6DUxGU 6yncoGY1V50BPvPW5ThTTM1RMSLpgo88i4X8Tb2Kru5Hg5fsbxVrbE6//ZNTGyqxthMX Udx58P2bp1GaOamHkptyPK7+ZF2OFoQAusb6VBt7OT0r6k2VkNqhHLGI9rwmnVT82sMI sdUagBlIgj4CI3m7Cft1+mjw0+LmDrFUm9ywsR+fmJemNhHpgyOcWc+H9GXkoKJraAkF Suuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=I7kW91bk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y8si8917153edw.80.2020.11.09.06.03.56; Mon, 09 Nov 2020 06:04:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=I7kW91bk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730332AbgKIOB5 (ORCPT + 99 others); Mon, 9 Nov 2020 09:01:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730035AbgKIOB5 (ORCPT ); Mon, 9 Nov 2020 09:01:57 -0500 Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51EEEC0613CF for ; Mon, 9 Nov 2020 06:01:55 -0800 (PST) Received: by mail-qv1-xf41.google.com with SMTP id e5so2338913qvs.1 for ; Mon, 09 Nov 2020 06:01:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/ruVSjDZDRurayBLmYyYR2veA1e5iE10q7XYnooMQvs=; b=I7kW91bk0uBvrlkJhQrFt5YKmaWbeu0rpb8qa6RuunmdqC2Hn4Kli2yhGMVByErrZB AZ5Vg9PkOzAAkRxa37YLlZ6HsMTgFOM7vsiq7EQFXLfZ4KQ9I54IEH1laoXwG3Y8Jko2 wLY11KBmfS/ZI1yG7JAnk6uUEfVdZRh2MWE8hHWMv/2CPCiSjRO8WnSMl+fSoNnr5BR/ 8pv6zU9+EhUMnvb7cLMvtxNAZCAYX4Kiui8dIdrdo4DrN5dtk00SSA5WwY/bs7ENg87l qRAOBYFHLOhYlKp5ug+Q9mLrcU+fKnTQRTbPVyMGOlDDHyalAvYfp1BYVQLsw6kko2oI AR0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=/ruVSjDZDRurayBLmYyYR2veA1e5iE10q7XYnooMQvs=; b=lHF25G+Wt0BBFtjcH6FPpHRv5NSuM6YZ5+OCZ9IWMxxpqIK0yLVO2WZOIZNifNNf/F rBjvkHGE624At/o+P53k+HS5YHr0uSwgSTZd6ro94f1UqUG9FxcFzKqLDPL21zky6miU 7rBuYBAP3JZVsB7NBirvEOQShwQFuzdgSIyMMvuZHvoXIhosG4lhttLVZ3XkNokoXNq1 Mny/BShuhN42cHR98kLXBVZhfDFrXLuNoIIUT2xj5S3TjQhwGjtWSvU2joXKKXCpNetw mJu3iLPld3UalIfQR6/csaRWHbK4fObG/4vW8+KY2jaz/Zez45L9PSzBw2c7/STlys09 StQw== X-Gm-Message-State: AOAM532crFrUcbcfsA5HTGpRZcfSrDjORoj3IvP2DCuavwWZSTcEz7lu 2OHsjiwela8OB0hoBjOBt5M= X-Received: by 2002:a0c:b2c6:: with SMTP id d6mr14783923qvf.38.1604930514196; Mon, 09 Nov 2020 06:01:54 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:fc2b]) by smtp.gmail.com with ESMTPSA id f189sm2240333qkb.84.2020.11.09.06.01.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 06:01:53 -0800 (PST) Sender: Tejun Heo Date: Mon, 9 Nov 2020 09:01:41 -0500 From: "tj@kernel.org" To: Trond Myklebust Cc: "peterz@infradead.org" , "neilb@suse.de" , "juri.lelli@redhat.com" , "mingo@redhat.com" , "jiangshanlai@gmail.com" , "mhocko@suse.com" , "linux-kernel@vger.kernel.org" , "vincent.guittot@linaro.org" Subject: Re: [PATCH rfc] workqueue: honour cond_resched() more effectively. Message-ID: <20201109140141.GE7496@mtj.duckdns.org> References: <87v9efp7cs.fsf@notabene.neil.brown.name> <20201109080038.GY2594@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Mon, Nov 09, 2020 at 01:50:40PM +0000, Trond Myklebust wrote: > > I'm thinking the real problem is that you're abusing workqueues. Just > > don't stuff so much work into it that this becomes a problem. Or > > rather, > > if you do, don't lie to it about it. > > If we can't use workqueues to call iput_final() on an inode, then what > is the point of having them at all? > > Neil's use case is simply a file that has managed to accumulate a > seriously large page cache, and is therefore taking a long time to > complete the call to truncate_inode_pages_final(). Are you saying we > have to allocate a dedicated thread for every case where this happens? I think the right thing to do here is setting CPU_INTENSIVE or using an unbound workqueue. Concurrency controlled per-cpu workqueue is unlikely to be a good fit if the work can run long enough to need cond_resched(). Better to let the scheduler handle it. Making workqueue warn against long-running concurrency managed per-cpu work items would be great. I'll put that on my todo list but if anyone is interested please be my guest. Thanks. -- tejun