Message ID | 20240116161929.232885-5-juri.lelli@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-27569-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp372003dye; Tue, 16 Jan 2024 08:31:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGlvNyDpP5xJh3oszv+s7QOzaLhDtJT1aqy2WQDhq6zYeeGx48WkDjjRX0dtN6R3kWv5yqg X-Received: by 2002:a17:902:ec86:b0:1d5:36e8:9ac0 with SMTP id x6-20020a170902ec8600b001d536e89ac0mr9030679plg.50.1705422674938; Tue, 16 Jan 2024 08:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705422674; cv=none; d=google.com; s=arc-20160816; b=FuE5GJk5IbQ1QPDn16oAtI8pdWfunq42KLqSaZ1em/0Vhc9lLix7d66TOcIRpXAgSv uvXnLGwz9GR6rt/4zpZqN+5fN9he1+dG/Ak1V5pv16BcEX3BD78cJvNya7DQnTKt6TAM kvpzdTwNwDVamdcsDbeemNL0rMr+ve3+d1YVIkFoCEaWi0gi2XyI9aQrcrAdrxtvFPoT /fXvzkfjVEeN+qn29szdAz88n8pNj5WNKbdqGOoNrHWrCppdB8QzXX9Oex75bFmDg4+B 5mRPaFevmxvk2ic98fFSBkcQ0/Kcx7vlbkglxkhYz7hEyUy4DC+3PcH5L1KmGoMLLZ91 TrCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=MbtUeDj38iJv40DVhrJMpGto1LA7FQWBcqkGB+BZKUs=; fh=Nsf1u1rbcJryyiFo9sS/VsYZC3vmqvYt/oMU7uIxbeo=; b=ij09HVMi7H1o9bxO8WHGZ1MyTfLqQs14GgBLTRQ40dPtJZVkevOxiGx/i/HnOdyoh9 z1ZaHgcnvm0o/NscRxMQJ21Vb6wK/mtGahABBMi+YBjzHplWXGWDYofUWVMu8DPDhM7F IxE4pUuuohIggorPL5fLZvXMSGmQFzoDj3iQzX9bMFQqgmpWDaO86lK0Q3Zjq8HThj1a xD92QKwmnxc9KA5fnm3bs84DH7n2ej9RCFCu4lTsGi37tDkO3eCxAJi26O31TaH7xr6x L77TU+1Mk0V19mlEpnoS5M+3evWM0rlEPm33iXmNG955XIhPod115/kyutkgaEwDvwuc 906w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AOYT6YOv; spf=pass (google.com: domain of linux-kernel+bounces-27569-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27569-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id jj18-20020a170903049200b001d4c4bdc0e0si11430493plb.537.2024.01.16.08.31.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 08:31:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27569-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AOYT6YOv; spf=pass (google.com: domain of linux-kernel+bounces-27569-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27569-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BC50828751F for <ouuuleilei@gmail.com>; Tue, 16 Jan 2024 16:21:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 393751CF91; Tue, 16 Jan 2024 16:20:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AOYT6YOv" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E1A51CA84 for <linux-kernel@vger.kernel.org>; Tue, 16 Jan 2024 16:20:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705422005; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MbtUeDj38iJv40DVhrJMpGto1LA7FQWBcqkGB+BZKUs=; b=AOYT6YOviBP7jy2mIIfB8ea/NYN4hKFi3nm14vrSBPgEROGbnJ0diDl17TLo7XsKbWxtaC 3pt1wNq83asZsNgjEOIsM0pYysgWeUrCXWe+tG097ECmKlVVHMw3HlJTDrJi/1qdo6e09Z 51OKKtkZmmat0VWgrr6bBPWLqR9+7Ys= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-5PMRCyo6M4SSjR1tL74EVg-1; Tue, 16 Jan 2024 11:20:03 -0500 X-MC-Unique: 5PMRCyo6M4SSjR1tL74EVg-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-429a7149210so81107851cf.3 for <linux-kernel@vger.kernel.org>; Tue, 16 Jan 2024 08:20:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705422002; x=1706026802; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MbtUeDj38iJv40DVhrJMpGto1LA7FQWBcqkGB+BZKUs=; b=FinF9XLiZDykhiViPj6zHY9xdJdUmYZd8TNOM6O04I1JiaYmyg+IVQjWXC1ptryDS5 2+ipEnHTxPQutfx7/IF3R7iHXa+S73nXIyubKSLvDPJc0ugctVN7TtXI2rde2E+iv+Ix OXB8g/mF82SZxuPczpjhFoZ2I6VLIA+ihpMnWU3bsWxI6nOHdnVQQba2/s0C47LWZ4gL uH3i0A9s4qJSwnPpDtvua3EgtVrsaTd77naywYkEJtkuZKYP0bzfs8Sk2WuOWqPiNQt2 djbm0TLRcf2iOba8pEY49lBaP+XZzcvGxXzwUJGarM/urRxK1RednGQA03DdFOKjXh6K 6T9g== X-Gm-Message-State: AOJu0YzWFj3JoFdXEbu8S1hCzsq+q60Rkcg1H8pi+USOAnpNJbMew3ta BO5fMnFOIjyjxyDvTuvXl1WNw3IO2NPSRAl0C3onG5PL8lC0eYnvN66AB76T8Ld2L8cL18wivWN LnJ0JaKK0zHnNMUzur094ysoSitCGWit8 X-Received: by 2002:a05:622a:120e:b0:429:ca1c:7fd3 with SMTP id y14-20020a05622a120e00b00429ca1c7fd3mr9264966qtx.68.1705422001906; Tue, 16 Jan 2024 08:20:01 -0800 (PST) X-Received: by 2002:a05:622a:120e:b0:429:ca1c:7fd3 with SMTP id y14-20020a05622a120e00b00429ca1c7fd3mr9264959qtx.68.1705422001616; Tue, 16 Jan 2024 08:20:01 -0800 (PST) Received: from localhost.localdomain ([151.29.130.8]) by smtp.gmail.com with ESMTPSA id fd10-20020a05622a4d0a00b00429d3257dd6sm3809166qtb.45.2024.01.16.08.19.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 08:19:59 -0800 (PST) From: Juri Lelli <juri.lelli@redhat.com> To: Tejun Heo <tj@kernel.org> Cc: Lai Jiangshan <jiangshanlai@gmail.com>, Aaron Tomlin <atomlin@atomlin.com>, Valentin Schneider <vschneid@redhat.com>, Waiman Long <longman@redhat.com>, Juri Lelli <juri.lelli@redhat.com>, linux-kernel@vger.kernel.org Subject: [RFC PATCH 4/4] kernel/workqueue: Let rescuers follow unbound wq cpumask changes Date: Tue, 16 Jan 2024 17:19:29 +0100 Message-ID: <20240116161929.232885-5-juri.lelli@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116161929.232885-1-juri.lelli@redhat.com> References: <20240116161929.232885-1-juri.lelli@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788265286421081174 X-GMAIL-MSGID: 1788265286421081174 |
Series |
Fix handling of rescuers affinity
|
|
Commit Message
Juri Lelli
Jan. 16, 2024, 4:19 p.m. UTC
When workqueue cpumask changes are committed the associated rescuer (if
one exists) affinity is not touched and this might be a problem down the
line for isolated setups.
Make sure rescuers affinity is updated every time a workqueue cpumask
changes, so that rescuers can't break isolation.
Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
---
kernel/workqueue.c | 6 ++++++
1 file changed, 6 insertions(+)
Comments
Hello, Juri On Wed, Jan 17, 2024 at 12:20 AM Juri Lelli <juri.lelli@redhat.com> wrote: > + /* rescuer needs to respect wq cpumask changes */ > + if (ctx->wq->rescuer) { > + set_cpus_allowed_ptr(ctx->wq->rescuer->task, ctx->attrs->cpumask); > + wake_up_process(ctx->wq->rescuer->task); > + } > + What's the reason to wake up the rescuer? I support this patch except for the wakeup: Reviewed-by: Lai Jiangshan <jiangshanlai@gmail.com> Thanks Lai
Hello Lai, On 17/01/24 11:56, Lai Jiangshan wrote: > Hello, Juri > > On Wed, Jan 17, 2024 at 12:20 AM Juri Lelli <juri.lelli@redhat.com> wrote: > > > + /* rescuer needs to respect wq cpumask changes */ > > + if (ctx->wq->rescuer) { > > + set_cpus_allowed_ptr(ctx->wq->rescuer->task, ctx->attrs->cpumask); > > + wake_up_process(ctx->wq->rescuer->task); > > + } > > + > > What's the reason to wake up the rescuer? I believe we want to wake it up so that it can possibly be moved "instantly" to a cpu inside its new cpumask affinity. If we don't wake it up it might be sleeping on a cpu outside its affinity which might have become isolated and this cpu could be affected by that wakeup if that only happens later on when possibly the rescuer needs to perform some work. Does is make more sense to you? > I support this patch except for the wakeup: > Reviewed-by: Lai Jiangshan <jiangshanlai@gmail.com> Thanks for looking at this! Juri
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 2ef6573909070..df7f2f2bfd0c8 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -4416,6 +4416,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) { + set_cpus_allowed_ptr(ctx->wq->rescuer->task, ctx->attrs->cpumask); + wake_up_process(ctx->wq->rescuer->task); + } + mutex_unlock(&ctx->wq->mutex); }