From mboxrd@z Thu Jan 1 00:00:00 1970 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 33EAA374186 for ; Tue, 21 Apr 2026 03:06:42 +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=1776740803; cv=none; b=XPHFfMLo2ZnqTPdGLyYYEaFr9EPjnuF6/8t5ioN9Xk1ni58Nygr2Qm2hFuCFMmqGMvTgW8cJBhqNXGenuFfdjzgWrw50VsowF2eQHmpHssq2oqXGc2ofWThtwgXd9GObs3DqyZ+fn/BZxtW4+QbDE8MmZUZfyiXjWkLzaZPuKEE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776740803; c=relaxed/simple; bh=y21cwGAHYaNaF8YRvTFnxXt2GMtqpW0sgbaYNH/AjnQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bn8qDzP+bWBBRrDs2X3LCkPkiVmgErFyEve0mrltBJnFeOu/vWExsjJ/dQXA3nwAcbXWIyz+KCZqcP51x6RI2PsujxhC8MV6vN1dXXOnyUa8FvG0y0hRzAwKNyEP7nj91oRH3Lt+MP8RgLsk46sqcLLgsT3rSmwhBpj5uoyHmgQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=KPkVULae; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KPkVULae" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776740801; 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=aKF+VwmZQV0pl/RDzNAg6PxSXQMnzdlIZnccx5H1z+o=; b=KPkVULaeI+ZeLGs78193eLzsIEpNv4o3+9Hrdlai4YinxG6PvcS0Trf7Zn59oJSl4hvWvd D1+lYMqs6QUsLljJ3HQHUTxXQbG1DdzZgmsn+ztAoYuM1XopGupUpSlLmfVYOdt8AHVTHh qv+VFjJNUz7/x8uuyt7UgBP6Cg1WqlE= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-195-8E3QXaAOMxq70JNFAK8-2A-1; Mon, 20 Apr 2026 23:06:38 -0400 X-MC-Unique: 8E3QXaAOMxq70JNFAK8-2A-1 X-Mimecast-MFC-AGG-ID: 8E3QXaAOMxq70JNFAK8-2A_1776740790 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 95D931956054; Tue, 21 Apr 2026 03:06:30 +0000 (UTC) Received: from llong-thinkpadp16vgen1.westford.csb (unknown [10.22.65.81]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 572CA19560AB; Tue, 21 Apr 2026 03:06:23 +0000 (UTC) From: Waiman Long To: Tejun Heo , Johannes Weiner , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Jonathan Corbet , Shuah Khan , Catalin Marinas , Will Deacon , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Guenter Roeck , Frederic Weisbecker , "Paul E. McKenney" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Anna-Maria Behnsen , Ingo Molnar , Thomas Gleixner , Chen Ridong , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman Cc: cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-hwmon@vger.kernel.org, rcu@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, Costa Shulyupin , Qiliang Yuan , Waiman Long Subject: [PATCH 13/23] sched/core: Use RCU to protect access of HK_TYPE_KERNEL_NOISE cpumask Date: Mon, 20 Apr 2026 23:03:41 -0400 Message-ID: <20260421030351.281436-14-longman@redhat.com> In-Reply-To: <20260421030351.281436-1-longman@redhat.com> References: <20260421030351.281436-1-longman@redhat.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 As HK_TYPE_KERNEL_NOISE is going to be changeable at run time, use RCU to protect access to the cpumask when needed. Some access of the HK_TYPE_KERNEL_NOISE cpumask is done inside the tick code that has interrupt disabled which is a rcu_read_lock() critical section. Anyway, housekeeping_cpumask() will warn if they are used in invalid context. Signed-off-by: Waiman Long --- kernel/sched/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 8952f5764517..6ae00c23d8a7 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1261,6 +1261,8 @@ int get_nohz_timer_target(void) struct sched_domain *sd; const struct cpumask *hk_mask; + guard(rcu)(); + if (housekeeping_cpu(cpu, HK_TYPE_KERNEL_NOISE)) { if (!idle_cpu(cpu)) return cpu; @@ -1269,8 +1271,6 @@ int get_nohz_timer_target(void) hk_mask = housekeeping_cpumask(HK_TYPE_KERNEL_NOISE); - guard(rcu)(); - for_each_domain(cpu, sd) { for_each_cpu_and(i, sched_domain_span(sd), hk_mask) { if (cpu == i) -- 2.53.0