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 X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24D4AC433E0 for ; Tue, 29 Dec 2020 10:14:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E01B8207BD for ; Tue, 29 Dec 2020 10:14:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726203AbgL2KN4 (ORCPT ); Tue, 29 Dec 2020 05:13:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725866AbgL2KNz (ORCPT ); Tue, 29 Dec 2020 05:13:55 -0500 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFF99C0613D6 for ; Tue, 29 Dec 2020 02:13:14 -0800 (PST) Received: by mail-io1-xd32.google.com with SMTP id r9so11677371ioo.7 for ; Tue, 29 Dec 2020 02:13:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nxxJyUupuOipVqoTejX62ILCfA+vlGogryHhEKFbgXA=; b=t1vAvkOIrQvUJghsdAHef/mFBJZBONF/ibczwETWJLN3/kF4IfMjuQOCHJHekhrkIi xOzlmW8/H8d78dMmVRhZYAXF3TUEx3AcYZ7b7oBFfrgOXg2ddz2HMnaeJB7Yb+UiyqUY hGlKOfLSJh7Ty+pNEnOLdUhEgsJB6Pqw/6vFH6mA5QKwncUrcArrSGO3h5AMPT9muhUh 4nheWbatKfjfbHuUglzEGy56676J/tAprsaa92Jo2OUdRkD+jjDE/8ajnX6KaCtiPGSI nLUzD1VnQMcUUWcEIWdHg/eGaaxCfy+RPQj3yLRfL9CR632O7ekqqSmcHLnf6HxwN6Pz bv2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nxxJyUupuOipVqoTejX62ILCfA+vlGogryHhEKFbgXA=; b=T7qBUZgxU/tGDuresCbjQ8fs6gEOiup7KtpTrP4y+dQkFfGrO2do3pW3mZ7jOZfEHl p6Beg+FyNoPQ/EbHA7e72GUPnvU0pwNvDztQo/P0rD0WNoxv26aL8ln4YSvrqnaWSQbE Fdw27Z19Vbf/pZZhjwsK9eqep7gNcgkZl1VXtj6MuN3Owc1O2SFZxEfhIdTdhVLi1/q9 rcYBCUHOwcJmGXsj71uMXoawHe1JzvbOx3ZKpCZN5+qeiGBcjK5bNoIWzC7b10hXY+Sf d6bQUiJgv3FZWIMNWj6LI10wma3Mo7WcYjburVPuGk7UEYGl0FKhRNGqoJaxj6Cg7wAg FI6g== X-Gm-Message-State: AOAM531jIoA+YNzQdqdGgPkxuayR+y7yyE83U5kh3oqJ2f1cgedbVUnf LFYQ1kKnBqTCpHrcZ3lZ5cNiM2yManyGkGiK+jM= X-Google-Smtp-Source: ABdhPJwlTBEKPyfmkrUYRDeAWuKw00YOIdDpHcmwcJ7RJfKRylbhO8ivnv06n3ne9ROff/Vi0IXpYin2XPt4EPlRc0A= X-Received: by 2002:a02:2444:: with SMTP id q4mr42147387jae.43.1609236793860; Tue, 29 Dec 2020 02:13:13 -0800 (PST) MIME-Version: 1.0 References: <20201226025117.2770-1-jiangshanlai@gmail.com> <20201226025117.2770-9-jiangshanlai@gmail.com> <20201229100639.2086-1-hdanton@sina.com> In-Reply-To: <20201229100639.2086-1-hdanton@sina.com> From: Lai Jiangshan Date: Tue, 29 Dec 2020 18:13:03 +0800 Message-ID: Subject: Re: [PATCH -tip V3 8/8] workqueue: Fix affinity of kworkers when attaching into pool To: Hillf Danton Cc: LKML , Valentin Schneider , Peter Zijlstra , Qian Cai , Vincent Donnefort , Dexuan Cui , Lai Jiangshan , Tejun Heo Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 29, 2020 at 6:06 PM Hillf Danton wrote: > > On Sat, 26 Dec 2020 10:51:16 +0800 > > From: Lai Jiangshan > > > > When worker_attach_to_pool() is called, we should not put the workers > > to pool->attrs->cpumask when there is not CPU online in it. > > > > We have to use wq_online_cpumask in worker_attach_to_pool() to check > > if pool->attrs->cpumask is valid rather than cpu_online_mask or > > cpu_active_mask due to gaps between stages in cpu hot[un]plug. > > In 5/8 pool->attrs->cpumask is not restored to avoid triggering > the warning added in e9d867a67fd03ccc ("sched: Allow > per-cpu kernel threads to run on online && !active"), is it likely > needed to repeat that trick here? > Is the above gap no longer existing here at the presence of > wq_online_cpumask? It still exists. When online, wq_online_cpumask is always cpu_online_mask, no thing changed. An alternative way is to move the code into a work item, which adds the proper protection against cpu hotlug and does the work. I don't want to add too much complex in this patchset.