Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5182720rdb; Wed, 13 Dec 2023 00:59:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIIIy93186nupol/uPfXPmevAwto74Z8RwmOSYVEyGqoy79yRb8e0IAYcOi/xxUbTtTv61 X-Received: by 2002:a05:6e02:1a0a:b0:35e:6c7c:b352 with SMTP id s10-20020a056e021a0a00b0035e6c7cb352mr11642886ild.17.1702457994042; Wed, 13 Dec 2023 00:59:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702457994; cv=none; d=google.com; s=arc-20160816; b=gnVAjafBJn+GWqMPag6mVsOwhmeOhby8AfpRQPjjUH29KhnEaU7smz5NusDjaOOIlR W9igRsFFtSLYhHgU76K5zvi1ovRLX2pWEiQW+cx0zaBE7KdSgnE0YNNQFSkeS+8gwTRa UNkurKqba+jJiEh+SsIHqMDocYuX34E38nw9G+hkuUEqjQ7KMGwAtFd1XHta0QtJ1zfl QtrVI3oAH2GJXA6mRKmGAwIC2Sj1jCU7yflFCnW028h3aP39svSZi+AZlDsAQvNFHMf5 qSXOYMfGxjJQOaxetcDDRM5DhikBiOi+AxIzZKH3HTh7pu37NMiWXGP9WvRRwgWVBDUH XtIQ== 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:dkim-signature; bh=OX4lZddGamu8EnfuDkp92NJESGRg8WCgQgponQ6BJCI=; fh=1CqPlySqPiCaeSrZ0glMCByHtsyOrAfvOKmHKyPOlJU=; b=TASe0ogSN8UKiR6ZXZOIK4g4HLoDHDwU8Fhrym9nzxzCxT8ZgEKwccWN+kUOyvxlvH 8a/D8hAnBhoXvOXSFglK5mLlzycu5z/3unfb1mNmgS53CNq2fhL4bc2lLpAhcP8c5Nai J7bvLPIqLJ/o4RownEz5ytin+GxE3KEkt6IRXDsLpfe9vW9k/7k+z9kOJv9sxC53i2Ft ORxlegBWXPt4/mSP5i0ynL3arl14tUFIrXSMFfhMCekS+JGFaGEm883X4vQHqwb+VWBp OuNRoWICpKuTI0PdRw1aTSRJo6S+ka+14PD6cXTkc32U1O5rT9HE+h4pafa3Hsb2WNev z8lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bTjhPbvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x4-20020a170902ec8400b001c88fc3c593si9761967plg.560.2023.12.13.00.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 00:59:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bTjhPbvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id EC22280BC450; Wed, 13 Dec 2023 00:59:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230404AbjLMI7n (ORCPT + 99 others); Wed, 13 Dec 2023 03:59:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjLMI7m (ORCPT ); Wed, 13 Dec 2023 03:59:42 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D094CAD for ; Wed, 13 Dec 2023 00:59:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702457988; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OX4lZddGamu8EnfuDkp92NJESGRg8WCgQgponQ6BJCI=; b=bTjhPbvUrg87jbHQw+/xc1OXDAyW/3v18PX+D2gufzFs2Ud12AbyJmhMg7Mna7nrqLZ7Ci W3Aw2uVjhUf3JFwF02ZamvVKtqIyb6VqZvuerpjDk/cFKyEjHh1oQLdpUlJYX1mfcCnpBC HMSYtUj6z91r+StZGhNDl9Dpi9hBzXE= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-600-hiSkGMXHPSOPvzVmjEJU9w-1; Wed, 13 Dec 2023 03:59:46 -0500 X-MC-Unique: hiSkGMXHPSOPvzVmjEJU9w-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40c464a1e5cso22506035e9.3 for ; Wed, 13 Dec 2023 00:59:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702457985; x=1703062785; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OX4lZddGamu8EnfuDkp92NJESGRg8WCgQgponQ6BJCI=; b=n1ERjA2gzLxvwUnn1YoS8sHwNSveCvv/XKT/feQVHBrWtAytJermMKC/KyXgrfynTr 3TwBdpfe0m3kzqJNK4AyqwfCpdgxWtC0a/NFWri+fGEsi0daYXco5gtqYWcki3vXDabV eXRANzfqb194sefLyXV6GfDx1EnzEzVtJgNeptHiTmGqaXc/HeJTXCoahQuWPMwkpUGC wIOd93z//fjIRc97ONz2b5a7gi1xs1z7c1b/BhnsAatQYoTZiU+/PNGvMbZg7ibzl/4t Nw4S6asMAydh86hKJr3bk9Qp6G5F3WmlDQGJZbMxK4ReX6VRaVIPBgQB6+xsZkmfkrTo q+cQ== X-Gm-Message-State: AOJu0YxbmSFSLyIt04YxNo5meUwYuw9jwJ6O0+g74tJ6QIoQn/pRhUtM ICx6cXWlkrSFwcBvzkrEfftBftUp59ZFUO+aT9YAbQpD/JVflcR/N5JCJdivWapBF8VbgiB3NI2 nJi1OmJMq1CwreBQyPcprV+Tn X-Received: by 2002:a05:600c:16c4:b0:40c:34e1:72d9 with SMTP id l4-20020a05600c16c400b0040c34e172d9mr2732952wmn.112.1702457984791; Wed, 13 Dec 2023 00:59:44 -0800 (PST) X-Received: by 2002:a05:600c:16c4:b0:40c:34e1:72d9 with SMTP id l4-20020a05600c16c400b0040c34e172d9mr2732947wmn.112.1702457984422; Wed, 13 Dec 2023 00:59:44 -0800 (PST) Received: from localhost.localdomain ([151.29.78.8]) by smtp.gmail.com with ESMTPSA id d13-20020a05600c34cd00b0040c496c64cfsm9313492wmq.12.2023.12.13.00.59.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 00:59:44 -0800 (PST) Date: Wed, 13 Dec 2023 09:59:42 +0100 From: Juri Lelli To: Tejun Heo 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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 00:59:53 -0800 (PST) On 12/12/23 07:14, Tejun Heo wrote: > Hello, Juri. > > On Tue, Dec 12, 2023 at 10:56:02AM +0100, Juri Lelli wrote: > > Hummm, OK, but in terms of which CPU the rescuer is possibly woken up, > > how are we making sure that the wake up is always happening on > > housekeeping CPUs (assuming unbound workqueues have been restricted to > > those)? > > > > AFAICS, we have > > > > send_mayday -> > > wake_up_process(wq->rescuer->task) > > > > which is not affined to the workqueue cpumask it's called to rescue, so > > in theory can be woken up anywhere? > > Ah, was only thinking about work item execution. Yeah, it's not following > the isolation rule there and we probably should affine it as we're waking it > up. 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); }