Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1477930rdb; Sat, 3 Feb 2024 07:48:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3jxZDfEy/uLH4fxWttnHeims3hq8QVCERirxQErBwGut3gf/K3aoPiOEc61aB05hY89VI X-Received: by 2002:a17:902:ecc6:b0:1d8:b8df:79da with SMTP id a6-20020a170902ecc600b001d8b8df79damr6640555plh.18.1706975319477; Sat, 03 Feb 2024 07:48:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706975319; cv=pass; d=google.com; s=arc-20160816; b=qOwp0xmC5tLaO6GT7weOb8TWNuWHI/1tL7RI92/Xj0C5nFsppOd5CU5sur50IYmLQ2 VdIjo+BTmAZuR07L3oeEHunnlfe/W5UFJuBDLRR80/eo5MfWrA/2D20jYN0dYdusxjdg LMoIhcRwqmmKOoEIqtbBZbzD+ND0c/KwzjIoggyZ0HX8dtCuKEQHD+aJQ26IOAEo1QgM gm2sZVA3fUrVlB7JgbJoC7E/AGHfNQhoK2O+QRb68ZhHNudqv5K/BWBHJcn5Lky32gJu +4QXy4KC7O38iA0zwS6l/cQvldGQYbfh+olx5ff/t22RYtlhWtsMxrjWBVI09058bR22 U4uQ== ARC-Message-Signature: i=2; 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=X2395hdNLA+e2lfzBFwx2gFoDSFHPhjOE9LGsAepU2M=; fh=CHlkk2o1rscxVzj6ifEO10XFZ5fD4ijjooxgqVFTF14=; b=rLE7iizk3EvVvsVEyUeMWspWUuC7sMjRCbkRvbePyZ8lfDhu2lnAWT6tKxWPwDTjN5 lWyMXSr9SQJ1cQpzdG8TPnoCxiaaTwdpcxdHQjqQMpsqF8cHf3tEdmFQQOaChjVAkqLJ RoqQ1iL1lQfXfD+WXd0cRBB4ecPPr5Tp6/LBHljHB6WIJCgLZlOJUYfMeh5naG+k8VFB DkZHIE0qNIeL4P/3J6UrULOXv7KR42LuRVEC5V8VwilN6gZHlwUPVCAuZGxDNG/6dlPw HvgDyISB7n3+/dZEnBrXiMu077igaHfkmGAlrOngb1oTph6PS6IOACMLJitgCq2DgT2m lAOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WjzxMAgk; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-51158-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51158-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCVNCMzQ3uFtt14QQV2gCzwCeUutXv1vV6KoR8sbUkhzF6vFGA207XvPYetSx42YGyEZYrTUu7/VaIv7pzX8uf3nvt73n0F532TVLqceXw== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 21-20020a170902e9d500b001d757b25122si3416595plk.235.2024.02.03.07.48.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 07:48:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51158-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WjzxMAgk; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-51158-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51158-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4A0A9B22EA6 for ; Sat, 3 Feb 2024 15:44:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C5ACA5F87E; Sat, 3 Feb 2024 15:44:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WjzxMAgk" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 6D7BD5F55E for ; Sat, 3 Feb 2024 15:44:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706975048; cv=none; b=dIWxxy10rmkNKE6BnZhuXTsoaXcrK5IXvfe3YHkD1PLH2DnJl3vxoLLjUBF0V2KRSDC7VOVBU99UpFcK8qGpukEPlGfm4pZzPgqqsMybot9UpESJpm8IKuChDNaU1W8lDGybBNqti4rM+e79Nmddl/EfxPjlJmxwdSJShp9Ffmk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706975048; c=relaxed/simple; bh=h5QmlYtfNPJkR43xmQK8MmClp8+0FgNrfjWDooIF2m0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hI6Z0gZLxAieT32sIs6vOW6QMeYZKBAf/2/822iMShMCtTuvv1sJTNaC8PwTOkPL9S0YYbbIZBLaO83wmglGgzEQb0DJbW295MJHL6Icq6gVLaA4IyDINRcLunF38W93jlDCbhuilykEAxKnRHnP1KufvBaQQGnuXWs7jzITRG4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=WjzxMAgk; arc=none smtp.client-ip=170.10.129.124 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=1706975045; 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=X2395hdNLA+e2lfzBFwx2gFoDSFHPhjOE9LGsAepU2M=; b=WjzxMAgkj36pZ35fZ6xBRi93t2HvO53jHTZVM6VOjM+EAtUwjRCKhiyB6IVNpn3pIpgZ5w pQs1pVx8nJoU3rfC/fwWD8U4q6DifCDJ//hrVme7ZEeT3ps4KWTcBpnsmrI4WQd6Auevly 6b+aSadqgxXqOcnIAzwT5t3ka5bvgBo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-573-LSgab-vdNNS5dJajugvDTA-1; Sat, 03 Feb 2024 10:44:01 -0500 X-MC-Unique: LSgab-vdNNS5dJajugvDTA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DC44E10651AF; Sat, 3 Feb 2024 15:44:00 +0000 (UTC) Received: from llong.com (unknown [10.22.32.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64ECB492BC6; Sat, 3 Feb 2024 15:44:00 +0000 (UTC) From: Waiman Long To: Tejun Heo , Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Juri Lelli , Cestmir Kalina , Alex Gladkov , Phil Auld , Costa Shulyupin , Waiman Long Subject: [PATCH-wq v2 4/5] kernel/workqueue: Let rescuers follow unbound wq cpumask changes Date: Sat, 3 Feb 2024 10:43:33 -0500 Message-Id: <20240203154334.791910-5-longman@redhat.com> In-Reply-To: <20240203154334.791910-1-longman@redhat.com> References: <20240203154334.791910-1-longman@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 From: Juri Lelli 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. [longman: set_cpus_allowed_ptr() will block until the designated task is enqueued on an allowed CPU, no wake_up_process() needed. Also use the unbound_effective_cpumask() helper as suggested by Tejun.] Signed-off-by: Juri Lelli Signed-off-by: Waiman Long --- kernel/workqueue.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index ee934c2c6ea8..172f7299aa71 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -4905,6 +4905,11 @@ static void apply_wqattrs_commit(struct apply_wqattrs_ctx *ctx) /* update node_nr_active->max */ wq_update_node_max_active(ctx->wq, -1); + /* rescuer needs to respect wq cpumask changes */ + if (ctx->wq->rescuer) + set_cpus_allowed_ptr(ctx->wq->rescuer->task, + unbound_effective_cpumask(ctx->wq)); + mutex_unlock(&ctx->wq->mutex); } -- 2.39.3