From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 44D533E1D05 for ; Thu, 23 Apr 2026 09:19:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776935977; cv=none; b=L70sEmemESyiWEkNkA3ttqrbujvZiADuhQWFGSLZQHmyXxL9uBYAo9/7glEnuwUZequZGySX8gEIgpO/o7fuuvRdQldZCEJKaJ2j9VRmV8CnuBbFZk97a5mgx1op4doCBKcwESkwocHp+utKCKwzW/nbWlyl+ZmNARYaPek3m98= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776935977; c=relaxed/simple; bh=4nX0Xrv++ISRob2So+K07pnbbPqrSjjHX6zINqin0rg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ScyMLvYkRaIhW+zFO7EAzevt1N738/e6Co49I5nH0+kxsntUPSTXDCv/eyfZ7MTg5sxUx4xkSFYVaFIbGvXvps4f4jsUgiYgZYqwpBMr64N7BK3erno0xNia1QUH7IL9hH14nu0Ar1aSsJKVxYy09MqgxZEMYX7egXI0wxV7ljM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=B3tYApPs; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="B3tYApPs" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63N6ZMRh2586157; Thu, 23 Apr 2026 09:19:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=corp-2025-04-25; bh=lmV+RDVuxZtp0PVFjel3ZDFYatO2n 4JLIhLLP1e6Vaw=; b=B3tYApPsN04FOGyl2AKhp3tM71qSl7/qCZkLSRAiQ92AE enyVRHXYGHbChBKsSCld2i34G6gKpxnf413pKBD+9Z6Z7ckSNY7iibysJ/EBnl02 9nWeH66cAzJTiRnTKIjh1Dosc1ghnc87w6A+tv4Jc5uOyHIzPLUENsBL8SxT2DY3 Mj47/or/OEFifixyf6rJF5ZVvcZ1l6/UryegkpzNSqsvU6TtLTQhiwSTPlMfExUm jQQPuveKP0PZXWMIeWVsVZHMqS13kXypIJtNs/RWGOq7aKNkbH46fTs+BCuz8Kx/ fSEVg88FblhXv3LxQAaQfmfjgzJQknB1WSdH3ZIqQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4dpenrk4kd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Apr 2026 09:19:16 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 63N9GNYV012948; Thu, 23 Apr 2026 09:19:15 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4dpjjrd0ns-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Apr 2026 09:19:15 +0000 (GMT) Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 63N9JFxx021237; Thu, 23 Apr 2026 09:19:15 GMT Received: from pssatapa-ol8-test.osdevelopmeniad.oraclevcn.com (pssatapa-ol8-test.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.253.175]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 4dpjjrd0n7-1; Thu, 23 Apr 2026 09:19:14 +0000 (GMT) From: Partha Satapathy To: partha.satapathy@oracle.com, anna-maria@linutronix.de, frederic@kernel.org, tglx@kernel.org, linux-kernel@vger.kernel.org, tj@kernel.org, jiangshanlai@gmail.com Cc: notify@kernel.org Subject: [PATCH 0/2] timers/workqueue: Add support for active CPU Date: Thu, 23 Apr 2026 09:19:05 +0000 Message-ID: <20260423091914.63645-1-partha.satapathy@oracle.com> X-Mailer: git-send-email 2.43.7 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-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-23_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2604200000 definitions=main-2604230090 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIzMDA5MCBTYWx0ZWRfX2rjOCRBZwDpY Bq4IWBEAngY1s3UaJJx8iIxSdOjOVOlvz0H7Y5geA/2yRcLXzJIC+C0AX2YmccLLb8B2ks7Z/Pc riN24A/3+modqXTxL16IdHcIu9qRCjlNNXU/Hb+vMoIzf+Y9BzpUlQQ2PU+RvxtghI4IGoskZ3g IeUjIdJoRt35Lo12EUl/DlONjrnhBCdahhNg7j+2ySysGNDPVNfxFHql1RzMxdEbtY5SqSTmDbw KVzDq9LDtk2jzg5j5v5WmWZVhfn/avgpu64SoQEspPIbhvk7o8ISlM2BMFKi7iXajqArZQKjXM5 jgaLXHnjpRCYoxRVKPeoqtL0lcfKJkGeTBzUUQabPIdA429FhS8Og4yVMUNYXrKyR2c7Ugv+1oK pAwDI/gYZcyvmtWbaWrHMC7ph63pfLW/XGAQ/VQyCNdtwNTBpqdFX5KKogV4BkSQm6ezlquh8oh 8nYsM7fZ0xrl39Po+2SW/sQuD9egYeHu53iU3CqE= X-Proofpoint-GUID: jS9vlHbfFcZvnh06Gv7mRgiPeDZZwbqO X-Proofpoint-ORIG-GUID: jS9vlHbfFcZvnh06Gv7mRgiPeDZZwbqO X-Authority-Analysis: v=2.4 cv=JeKMa0KV c=1 sm=1 tr=0 ts=69e9e414 b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=RD47p0oAkeU5bO7t-o6f:22 a=yPCof4ZbAAAA:8 a=4UxvkmMZTy4P8OM0KvgA:9 cc=ntf awl=host:12291 From: Partha Sarathi Satapathy Hi, Timers queued with add_timer_on() and delayed work queued with queue_delayed_work_on() currently rely on the caller to ensure that the target CPU remains online until the enqueue operation completes. In practice, CPU hotplug can still race with that sequence and leave the timer queued on an offline CPU, where it will not run until that CPU comes back online. For delayed work, this has a direct knock-on effect: if the backing timer is stranded on an offline CPU, the work item is never queued for execution until that CPU returns. In many cases, the target CPU is chosen for locality and cache affinity rather than as a strict execution requirement. Falling back to an active CPU is preferable to leaving the timer or delayed work blocked on a dead CPU. While callers can try to track CPU hotplug state themselves, that does not close the race, and taking the hotplug lock around enqueue operations is too expensive for this class of use. This series adds opt-in helpers for that fallback behavior without changing the semantics of the existing interfaces: - add_timer_active_cpu() queues a timer on the requested CPU only if the target CPU's timer base is active; otherwise it falls back to the current CPU. - queue_delayed_work_active_cpu() uses the new timer helper for the delayed timer path and updates dwork->cpu to reflect the CPU actually selected for the timer, so the work item is queued on the same active CPU. The existing add_timer_on() and queue_delayed_work_on() behavior is left unchanged for callers that require strict CPU placement. Partha Sarathi Satapathy (2): timer: add add_timer_active_cpu() workqueue: add queue_delayed_work_active_cpu() include/linux/timer.h | 1 + include/linux/workqueue.h | 3 ++ kernel/time/timer.c | 45 +++++++++++++++++- kernel/workqueue.c | 96 +++++++++++++++++++++++++++++++++------ 4 files changed, 131 insertions(+), 14 deletions(-) -- 2.43.7