Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5593043rwr; Tue, 9 May 2023 03:50:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7njRDyq40J/0TiwzuxVCskMGC5/7f3EPmkwPE++AxqFWjeMvFAlUZLRK8jPLAjbdyUr44D X-Received: by 2002:a17:90b:17d0:b0:23d:15d8:1bc3 with SMTP id me16-20020a17090b17d000b0023d15d81bc3mr13502800pjb.39.1683629445721; Tue, 09 May 2023 03:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683629445; cv=none; d=google.com; s=arc-20160816; b=a2VEWGTaVRMhEYEM6d4vobnLRbhctBGYMe+89E0Uo7s5KMXapkPOeuf4d0VBcuaLaB VIzu7g83dd5+KcaPKQx2pLYWQE+ax/FgJ6UjudWfvV+gy67vu8Di4K7IgAQyCFzYOuMB FyPYAFbxQ8J+5w7WoaqA2Zd7mR1ZJdaCSxmrMagGPuFU69eiB7buOpJyBi+NpoLllcwz vZ2wOV/kdGj63HLY76pvG//zmnOt1x/0VCVvS7OLEur8hMmW9PFfv0f9nYeHBhRYtXx8 TFbJ6laVIZJv1/frgLaSm5/gSqvuT0tmetjrJP1xVSrDdek+7EO+cP2YePSdvOmSE8RU 37GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=/B/JxdTpTSm8TrOKwDr414zDN7BjzoPhSRqGep6PTzY=; b=BVIDSo24+BFv2s+JLUHSYAf3+2hPcUSLS0uYjdD72aYHyhk6q3vVf+eyPwWgLeWGpm EG5G8PD+kxwHs/Nh6k39pHDtJmG8a1JlPQEBF00hw9I8E24w1+9eIkH4wGGwtqV0aBY2 CMyLnnE52u6PggTxllID1xfJmD2twu92/lROSwJkEhdenTGQrH+Xy5vL3BIGEWiXrN01 NTozmP9zluepBI0rvOcmuzjnTmFE1EWfIQKb0Wg5TKycRicinvSN92lHMrH7AgzhRVse xTIOQx/V4TfiIjUqnYs2xA2droHhcgUcMPGwIwkUCNZznmil9La8KYRjUsOsnhPSN5Q2 XCPQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y23-20020a17090aa41700b00235dc16de3asi15194751pjp.16.2023.05.09.03.50.29; Tue, 09 May 2023 03:50:45 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235364AbjEIKqt convert rfc822-to-8bit (ORCPT + 99 others); Tue, 9 May 2023 06:46:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235365AbjEIKqp (ORCPT ); Tue, 9 May 2023 06:46:45 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E66E7D2CC for ; Tue, 9 May 2023 03:46:43 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pwKrb-0008OZ-II; Tue, 09 May 2023 12:46:35 +0200 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pwKrZ-002DJr-Tp; Tue, 09 May 2023 12:46:33 +0200 Received: from pza by lupine with local (Exim 4.94.2) (envelope-from ) id 1pwKrZ-0005Ao-7z; Tue, 09 May 2023 12:46:33 +0200 Message-ID: <63bf19dc9ce534703597e830799aa0866a6156b8.camel@pengutronix.de> Subject: Re: [PATCH 12/13] media: coda: Use alloc_ordered_workqueue() to create ordered workqueues From: Philipp Zabel To: Tejun Heo , jiangshanlai@gmail.com Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, Mauro Carvalho Chehab , linux-media@vger.kernel.org Date: Tue, 09 May 2023 12:46:33 +0200 In-Reply-To: <20230509015032.3768622-13-tj@kernel.org> References: <20230509015032.3768622-1-tj@kernel.org> <20230509015032.3768622-13-tj@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.38.3-1+deb11u2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Mo, 2023-05-08 at 15:50 -1000, Tejun Heo wrote: > BACKGROUND > ========== > > When multiple work items are queued to a workqueue, their execution order > doesn't match the queueing order. They may get executed in any order and > simultaneously. When fully serialized execution - one by one in the queueing > order - is needed, an ordered workqueue should be used which can be created > with alloc_ordered_workqueue(). > > However, alloc_ordered_workqueue() was a later addition. Before it, an > ordered workqueue could be obtained by creating an UNBOUND workqueue with > @max_active==1. This originally was an implementation side-effect which was > broken by 4c16bd327c74 ("workqueue: restore WQ_UNBOUND/max_active==1 to be > ordered"). Because there were users that depended on the ordered execution, > 5c0338c68706 ("workqueue: restore WQ_UNBOUND/max_active==1 to be ordered") > made workqueue allocation path to implicitly promote UNBOUND workqueues w/ > @max_active==1 to ordered workqueues. > > While this has worked okay, overloading the UNBOUND allocation interface > this way creates other issues. It's difficult to tell whether a given > workqueue actually needs to be ordered and users that legitimately want a > min concurrency level wq unexpectedly gets an ordered one instead. With > planned UNBOUND workqueue updates to improve execution locality and more > prevalence of chiplet designs which can benefit from such improvements, this > isn't a state we wanna be in forever. > > This patch series audits all callsites that create an UNBOUND workqueue w/ > @max_active==1 and converts them to alloc_ordered_workqueue() as necessary. > > WHAT TO LOOK FOR > ================ > > The conversions are from > >   alloc_workqueue(WQ_UNBOUND | flags, 1, args..) > > to > >   alloc_ordered_workqueue(flags, args...) > > which don't cause any functional changes. If you know that fully ordered > execution is not ncessary, please let me know. I'll drop the conversion and > instead add a comment noting the fact to reduce confusion while conversion > is in progress. > > If you aren't fully sure, it's completely fine to let the conversion > through. The behavior will stay exactly the same and we can always > reconsider later. > > As there are follow-up workqueue core changes, I'd really appreciate if the > patch can be routed through the workqueue tree w/ your acks. Thanks. > > Signed-off-by: Tejun Heo Reviewed-by: Philipp Zabel regards Philipp