Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5397737rdb; Wed, 13 Dec 2023 07:36:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHl43npZMyf9pdgh1SHc7lG3HWq/tOuZjVMxIYfHpZBDbWXhI9htAQ6UukxHcLzzR9xfGBU X-Received: by 2002:a17:903:228b:b0:1d0:6ffe:a1a with SMTP id b11-20020a170903228b00b001d06ffe0a1amr8967265plh.120.1702481784633; Wed, 13 Dec 2023 07:36:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702481784; cv=none; d=google.com; s=arc-20160816; b=c5RjDCxo/Et1DwUSrEMkNpY8bcl14xP/Px9Nji9C/Q4J6bYS3qkpJLPZ15pqDJE5Eg 7S9/8OajTwqLLR1Chni8dd50RYb9lVzcw32uhUJ+rQn5kW3scKIGw+NpDCcG+mjNy41+ +/Hzr84VsdvWERwoRQh1cYT1Wy+COcJzixSYLvjfphhbrgZ2GzWuqpxMchsMIBcn0TXG pIbm79XQ40gvLkQT+OP54NPI5aNuGut3hz/CipZVnuOz7F7HsN5D6XWDv69GqG0uVg0W 9XlyPB8AEB3ZFwQWn0E8aOGHVj1R2d5cKdK5bengugJ52uEdcqz0LPVwRLFibHiIaong takw== 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=YSYeywzLgqaZI2MS9nHX0Fs7SGO3wtfBMr/dgErcxP4=; fh=og76fjkLdEf9SHPYfs3hJrcMXSvEdFsnNc6whBLuRAE=; b=QfQxihLjVwpEaLTrWwbdzi01maEdR/qYdNijRTEdRilFZqHNIn93eChblgrQiwaXIW 0LqfLgRakWrUfuaJrGSs609SB/Ts8I+JBbG32Apsbl1+QibXym+BmOkixp9IG2Rc/KU9 Ah2vTiGkvxVW+IVtZpllGrw6tQry7iYzOAp8H5GkqJIYxHVPdNAVJpx3MjsT5TPoD6KC K3UKc0HpurVHX4xrMiL/cKzQtBBjrxaYiYeSVlr+HxsGqzuPTetwmP3AIqv5+Rn1eCSM LZAfNg5kr/Qpk79bsl3BHPtz/VXGDOnXeVu4XcewBeeGEksqrT1IbHMl68CBersigpmi H6Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RqkWWchH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id l21-20020a170902d35500b001d09b00de2asi7566675plk.587.2023.12.13.07.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 07:36:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RqkWWchH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 5FB7980737ED; Wed, 13 Dec 2023 07:36:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442038AbjLMPgJ (ORCPT + 99 others); Wed, 13 Dec 2023 10:36:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442703AbjLMPgB (ORCPT ); Wed, 13 Dec 2023 10:36:01 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85B4A10C8 for ; Wed, 13 Dec 2023 07:35:54 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1d336760e72so18497905ad.3 for ; Wed, 13 Dec 2023 07:35:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702481753; x=1703086553; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=YSYeywzLgqaZI2MS9nHX0Fs7SGO3wtfBMr/dgErcxP4=; b=RqkWWchH8Zcw1tgNhAEq3A6UDwHbb9k7z4+OrJ7cklt22xDMzgZ0DbOpXWnKCzYBAX lXMiiV/P/N5K5hla45QiO2sLd+aLIg0GUFDdceysuCuOW6N52UjSUlJ/TTeCSYjrjpeg AIaTyeLebxAiex4EwLuttvglUEtSq+74wuNdtL0rDM+3QmcQfSJDMnWyjIUQIlxu1jHO +bEhocRydl8Lgm2zruSHts27bb+6oz1knNJmgrIa+UFA2gHGrHSr/r5gCWjEQsPYxr5s 3RakdyxaLdJUfN66ANHOTEBncR2NTksJ3IAY0hcyY5o9Stx2I1IXI67XAIhAlsPg3dI3 5zKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702481753; x=1703086553; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YSYeywzLgqaZI2MS9nHX0Fs7SGO3wtfBMr/dgErcxP4=; b=HRf3pRovZ5S74TxJM5QP05nrhU+8FrkcFmORFS6CPUnmuclrCC0LpSztCSV5lrYj9v bzEZ1zAZSI5tzwXmsA4g+eJOTKiCGVlV+5ddTqKEYOmtlRFNL05hnvBGFl06JtL/WU6a JDyYIiFi8CpbEvfYKGhRU7WDwXaZcnvDBecLzSHxoqsAwziVNJ0YFjjhZa6uQ3anhKXs Njwxm/orOyDwQWFj1LP9eRi2DA9FuDeri+gTZfkwuUDLgpa01eyIjlSFbCNHk/c6Pz/s 918D74LG3CQC6KIjoIms56KENNTDHo94bwqqUVciYMObwGzG0h0ICFU2UeHJbaDNC+BA qmEQ== X-Gm-Message-State: AOJu0YwvFAIZXiGqI1HiVaGvISS45QBa374SsXdo5MT7FLfwzFrZTjF2 oC8kyNoVmiQAsRbl9VC57bwys7zKEb0= X-Received: by 2002:a17:902:6bc4:b0:1d0:acd7:97fa with SMTP id m4-20020a1709026bc400b001d0acd797famr7982784plt.127.1702481752879; Wed, 13 Dec 2023 07:35:52 -0800 (PST) Received: from localhost (dhcp-72-253-202-210.hawaiiantel.net. [72.253.202.210]) by smtp.gmail.com with ESMTPSA id k9-20020a170902c40900b001b9e9edbf43sm10711595plk.171.2023.12.13.07.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 07:35:52 -0800 (PST) Sender: Tejun Heo Date: Wed, 13 Dec 2023 05:35:50 -1000 From: Tejun Heo To: Juri Lelli Cc: Aaron Tomlin , linux-kernel@vger.kernel.org, jiangshanlai@gmail.com, peterz@infradead.org Subject: Re: [RFC PATCH 0/2] workqueue: Introduce PF_WQ_RESCUE_WORKER Message-ID: References: <20230729135334.566138-1-atomlin@atomlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 13 Dec 2023 07:36:22 -0800 (PST) Hello, On Wed, Dec 13, 2023 at 09:59:42AM +0100, Juri Lelli wrote: > Something like the following then maybe? > > --- > kernel/workqueue.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/kernel/workqueue.c b/kernel/workqueue.c > index 2989b57e154a7..ed73f7f80d57d 100644 > --- a/kernel/workqueue.c > +++ b/kernel/workqueue.c > @@ -4405,6 +4405,12 @@ static void apply_wqattrs_commit(struct apply_wqattrs_ctx *ctx) > link_pwq(ctx->dfl_pwq); > swap(ctx->wq->dfl_pwq, ctx->dfl_pwq); > > + /* rescuer needs to respect wq cpumask changes */ > + if (ctx->wq->rescuer) { > + kthread_bind_mask(ctx->wq->rescuer->task, ctx->attrs->cpumask); > + wake_up_process(ctx->wq->rescuer->task); > + } > + > mutex_unlock(&ctx->wq->mutex); > } I'm not sure kthread_bind_mask() would be safe here. The rescuer might be running a work item. wait_task_inactive() might fail and we don't want to change cpumask while the rescuer is active anyway. Maybe the easiest way to do this is making rescuer_thread() restore the wq's cpumask right before going to sleep, and making apply_wqattrs_commit() just wake up the rescuer. Thanks. -- tejun