Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp900439rwe; Fri, 26 Aug 2022 17:49:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR60h63A8KfyR73DJFbDC2lzSaElu28i0OODuiBqkCWxqh4Mmjcha3rW4sokNoBbWuAzIFrt X-Received: by 2002:a17:907:a046:b0:730:9c7a:eab3 with SMTP id gz6-20020a170907a04600b007309c7aeab3mr7175377ejc.285.1661561376083; Fri, 26 Aug 2022 17:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661561376; cv=none; d=google.com; s=arc-20160816; b=xnaxyPW8TwPLiOhuMSqaI1NfsqOEiG+HtMeMz7gG+sRruvUd3pkCHWg2K7p2mx4fYg YlDqxOYnhK/MS+hQF4xabcqmCggdYOdVci+knyOrzSxmr9cmgOEdrM2J1w7v2+GMhZd5 Xy4c1GVhCvbgFj22VPDsSf63G2WdFcVGQtKmDkST1Pzjz2QZzZARrvQZC4GGUMpad7/m mR8mtBvfc0rlY+odLsGlsHLwpJ9I6y7x5+q1ZKR/ng0K+x5aPuAiLGaWN7eIJX2Epwmb pDA51+u4Hr9yv/DdBPKqcNzq1YKp3ZP7XXZCgN/T0PAii37tDXS1cN/T5xzeLYr/u6KO A6og== 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=14KpB5p7sZ3dVxtoeGHlHAy+LcMprsDaESSmFVj0Geo=; b=wZ50iT94ikR/S495nk/GohmRQcEMPdZmny6n5Bta9YtRFK7eli8QGnwegiJ1lvQazd MyzMzx6dqQYSc8jrnVWZuc6QDBfSKtKDvw9IZXeaNMlHwPnk8ljYWQKnZFdz/ySfXhN2 h0M6sDsycuBBOfRf8OlajtML8TR4cVpiGGu+yqMZnWyrKQWoll18GGlOkiUZrD3BlLJ8 pSt7pdCC6XImHJBG7EDcEwPkqmbKjwc2PWNmcjzGdbJLpqkltWNHczycYicabX2/asuX ybW1/zbEOF8hyYpt6lAyOdML0LG+FboWHe5VLpiYaIo2kUq70KSse/wq3CuWFAQKWKKi zqDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=J65P8wFF; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020a170906975300b0073c5d9b3440si2135776ejy.781.2022.08.26.17.49.10; Fri, 26 Aug 2022 17:49:36 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=J65P8wFF; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233332AbiH0Ad5 (ORCPT + 99 others); Fri, 26 Aug 2022 20:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230172AbiH0Ady (ORCPT ); Fri, 26 Aug 2022 20:33:54 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B830E1168 for ; Fri, 26 Aug 2022 17:33:54 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id v23so2914700plo.9 for ; Fri, 26 Aug 2022 17:33:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc; bh=14KpB5p7sZ3dVxtoeGHlHAy+LcMprsDaESSmFVj0Geo=; b=J65P8wFFHZx2QuvqZamtjeDO5Snhz0qIBKV4vBTBh8708yABn+LsVsoPenJ2C6r6H7 PYVcV7ugxrFDsaRxIpOKcN7IiHZrYo0ruO4DaLRyVQNUtUvVYAru7DeNFs9v6+h1T9WE e/EWJIFPdM7Yc8/I3DfCoSNPZ8uQEvIvGTM1zd1A4dH6H//m3Q6A52/C3FUxKKA+YxyE 5+sjtMOa40Fq8s61n8LuEkCSGgJWdowMdFZ8r5j2pNfi3dv86Mq5g6DDlA5iUvSNOZdC pusx0VCZOuBJX+XpyYKAwimqU96xZySW+CscIq43CN1+6wwx3MR3UuxU5JQPGhImNuB3 6tpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc; bh=14KpB5p7sZ3dVxtoeGHlHAy+LcMprsDaESSmFVj0Geo=; b=ZfaDFsHB0f+mIg7vTryQ4OGJxfS9wpyz32Au8ufKo4ZPgUUaV7mJtJfeuaXgSiILG1 8Ami/SsaW+vGathkk15ngtoI319I45d1jM7y020owtPKXflY5FBQ6Aidjgy9ccjqZrME SVgeEuq1dCkZWUGcV5zyugQNoAVmUhz4Ejv9wdo37AttZRbYyI/VmNHUysuPZQS/dr2p 634A4nICMDQJnK9ioPd3uy5ciI4+PXCT9rOwLy8yG7v2IsVsztgiVhFYb4b+4RmtwKxR dLzzlbL2bZDaaXw0kJIzcoGDsCLAxAo4JkzqNrWfxL9p2ksPPVKhXS+JAe52KYwhlvm/ 81tQ== X-Gm-Message-State: ACgBeo07LmABFcgFIk47sxKhrKq+00GOW6Jg5aCz6EKGIUNZiiCBYvjg ecW8YulqYg2rR/WLbLc/ATg= X-Received: by 2002:a17:902:d505:b0:173:cf6:f819 with SMTP id b5-20020a170902d50500b001730cf6f819mr6074130plg.117.1661560433534; Fri, 26 Aug 2022 17:33:53 -0700 (PDT) Received: from localhost (2603-800c-1a02-1bae-a7fa-157f-969a-4cde.res6.spectrum.com. [2603:800c:1a02:1bae:a7fa:157f:969a:4cde]) by smtp.gmail.com with ESMTPSA id b14-20020a1709027e0e00b0016befc83c6bsm2215522plm.165.2022.08.26.17.33.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Aug 2022 17:33:53 -0700 (PDT) Sender: Tejun Heo Date: Fri, 26 Aug 2022 14:33:51 -1000 From: Tejun Heo To: Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Frederic Weisbecker , Juri Lelli , Phil Auld , Marcelo Tosatti , Lai Jiangshan , Zqiang Subject: Re: [PATCH] workqueue: Protects wq_unbound_cpumask with wq_pool_attach_mutex Message-ID: References: <20220818143348.1134136-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220818143348.1134136-1-jiangshanlai@gmail.com> X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hello, On Thu, Aug 18, 2022 at 10:33:48PM +0800, Lai Jiangshan wrote: > @@ -5342,6 +5344,11 @@ static int workqueue_apply_unbound_cpumask(void) > apply_wqattrs_cleanup(ctx); > } > > + if (!ret) { > + mutex_lock(&wq_pool_attach_mutex); > + cpumask_copy(wq_unbound_cpumask, unbound_cpumask); > + mutex_unlock(&wq_pool_attach_mutex); Is this enough? Shouldn't the lock be protecting a wider scope? If there's someone reading the flag with just pool_attach_mutex, what prevents them reading it right before the new value is committed and keeps using the stale value? Thanks. -- tejun