Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp197561rdb; Thu, 22 Feb 2024 00:17:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV8lZmXh1nmyQnyZQ6BT6dabPhfmFrDLS2Lsnt2fCJ2P+aDNPMYjDkfMeZxKqHfzX4Jj/3U3lVAkg9R/iQVW6rzfTjGC5aXsvxgOsZ8Yg== X-Google-Smtp-Source: AGHT+IHDDI80ux3+DED8OSsAi4EMvx84q70h7aQx0IUo4YLUmLsmH+nhGvA/LNTjKcpSXXPRwirl X-Received: by 2002:a17:90b:4a0c:b0:299:3334:51d1 with SMTP id kk12-20020a17090b4a0c00b00299333451d1mr15101797pjb.10.1708589860374; Thu, 22 Feb 2024 00:17:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708589860; cv=pass; d=google.com; s=arc-20160816; b=uM2bjv/qh/A0CMZ6aBlNK6BfTGX71QqLZZU5Zg7U6BTn/VvgtsfT9o78nBYbfbuZnJ jVanLg8ZFXDiyGxqmPkvs0FGsmKchyiWyOqqqiS0yW3AuWmXVOKQAWa/6vpvAW+Wpm9W Xc+FRsX0SNYHDCFqrZiBzpUNbg9q8yHyibH0ojWFG1+eEssFcGDrcjqQMcsQFht8Ayp6 m5Y5YiVc2Rb7EJFmGXsAY7qunwO6NsFXZhZV4Pwk9pPgmCHkvOQHKEsYDmte3HDYxs7J ctUkhfeHBaARoSr42tR9//sxMlSd/CPN7ZiuKxax2/J2wbx4Ty3HCum6xriceqib7Un+ Yguw== 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:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=nBHC4CObQg9jlsK5jcnmuxSj9RPWw35ZNyR9OlhjLls=; fh=CZZAuxBV9d+zs+tRcZ4GPUuv8LYZZ5I0ZXPFgt7dODs=; b=EV02Iqq83pQRKvl5nNuiJ3smtGyVUqS/Y7H5+DyhoyS0aOTIXZcXdD9lV8y3LOwsUa 0QdWbrOPt3eB4KsFrwEr6MhfXkoRRID8JlEkvuUL53Z2JHKLszJdHrzbfcS0uSsKmEmQ gkZbJsCGSaEJOQBK4Oc9Kxt5GYnPzF9sJFAN2NZvH6682eXrhC7SBKAEUwaDiY58HWJF WDqRqvhW1R4Jj1Uzqj845rDjmgyFnc+eHuVxN2L1oLLTE5pXlPtTWEfKau7g2egLvsSu rNDWVsHlOcFL15MqcmfSkcmwaHbtwCHWDhQIQ7sB7d/9zZ6Xc+BLSdW2bvkUIopD4Z5C saAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=da+44rl7; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-76077-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76077-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id qj4-20020a17090b28c400b00296a6ace56dsi8822351pjb.189.2024.02.22.00.17.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 00:17:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76077-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=da+44rl7; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-76077-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76077-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 1A2202827B5 for ; Thu, 22 Feb 2024 08:17:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C8112182CF; Thu, 22 Feb 2024 08:17:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="da+44rl7"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2x+XYiX6" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 6BAFB17597 for ; Thu, 22 Feb 2024 08:17:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708589855; cv=none; b=C2IueqEZ6z8vxUvhRlbQydY8WTsy0KXaVsqKqDjltngw7tiYVtJfMQkC3lNn7U+/U35Bs1ojyw7S+afa5uV6Hj46L06COb2nE89mUVopQgQHW+MA4jMjOOk4cWPzixftZzghuRfhCb1Og5eer3cErYfuq7Op/ABNS80qE5Fjg0w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708589855; c=relaxed/simple; bh=adkXh00OWymd9FZr7L/tjffgMKrN341zi5GBQtdzcx8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=jDrNWsWELOOCTaB/VyBncTUZTkMI5KwNbX/4q5m9129B1LFQOkMXFX3/9/xGSyunmBVZV+UZ/TcUwmspsCI7t3yYrZBJs1uas19sPwKcD7bXmxkD/SGr7Z/fY/5EUlTjU6OpATxT5sGYCNrqSpMETuEYCHZWuBNwi3YKSUOjiGU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=da+44rl7; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=2x+XYiX6; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708589850; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nBHC4CObQg9jlsK5jcnmuxSj9RPWw35ZNyR9OlhjLls=; b=da+44rl7ASMRgCl/1NV6NxaXl/3s0um2+3GYdhSljS/BpG19h+Ladt5MlnR6w/UPGCR3Xy XfEirIgpzGCawIve04B8xyjS1v7SeGfdMqmiDhjFNUklimKTfQdUrHEG7j7PUlECidczx8 4ovPkKhyzR6PghFtG0KYT7+sfA6ctZLXXWZU5GE+lVGDUEENgoroxb+gXVNleIwQMIQhpA B8HYKjGZ/rgtriDlJ3f0eosayIzpCuVMJhHbThAd7p4LzQmsy7YySMTQCrSBZWovf8Cc29 n+yz9VGKBOPHY5s6M9sU47WnuopLp8DoWoxBf8RPQdK3wrc1BQvrLgI4sf0AWA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708589850; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nBHC4CObQg9jlsK5jcnmuxSj9RPWw35ZNyR9OlhjLls=; b=2x+XYiX6z0HY/mcyg7CWoKjh7tTaHMjwzbi/PI+8s4cJVbKlssj8wps8NOs4kGyc4F+CFR fvLRx6P9+yVMJNBQ== To: Frederic Weisbecker Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Rik van Riel , Steven Rostedt , Sebastian Siewior , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Srinivas Pandruvada , K Prateek Nayak , Christian Loehle Subject: Re: [PATCH v11 18/20] timers: Implement the hierarchical pull model In-Reply-To: References: <20240221090548.36600-1-anna-maria@linutronix.de> <20240221090548.36600-19-anna-maria@linutronix.de> Date: Thu, 22 Feb 2024 09:17:29 +0100 Message-ID: <87jzmwnc9y.fsf@somnus> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Frederic Weisbecker writes: > Le Wed, Feb 21, 2024 at 10:05:46AM +0100, Anna-Maria Behnsen a =C3=A9crit= : >> Placing timers at enqueue time on a target CPU based on dubious heuristi= cs >> does not make any sense: >>=20 >> 1) Most timer wheel timers are canceled or rearmed before they expire. >>=20 >> 2) The heuristics to predict which CPU will be busy when the timer expi= res >> are wrong by definition. >>=20 >> So placing the timers at enqueue wastes precious cycles. >>=20 >> The proper solution to this problem is to always queue the timers on the >> local CPU and allow the non pinned timers to be pulled onto a busy CPU at >> expiry time. >>=20 >> Therefore split the timer storage into local pinned and global timers: >> Local pinned timers are always expired on the CPU on which they have been >> queued. Global timers can be expired on any CPU. >>=20 >> As long as a CPU is busy it expires both local and global timers. When a >> CPU goes idle it arms for the first expiring local timer. If the first >> expiring pinned (local) timer is before the first expiring movable timer, >> then no action is required because the CPU will wake up before the first >> movable timer expires. If the first expiring movable timer is before the >> first expiring pinned (local) timer, then this timer is queued into an i= dle >> timerqueue and eventually expired by another active CPU. >>=20 >> To avoid global locking the timerqueues are implemented as a hierarchy. = The >> lowest level of the hierarchy holds the CPUs. The CPUs are associated to >> groups of 8, which are separated per node. If more than one CPU group >> exist, then a second level in the hierarchy collects the groups. Dependi= ng >> on the size of the system more than 2 levels are required. Each group ha= s a >> "migrator" which checks the timerqueue during the tick for remote expira= ble >> timers. >>=20 >> If the last CPU in a group goes idle it reports the first expiring event= in >> the group up to the next group(s) in the hierarchy. If the last CPU goes >> idle it arms its timer for the first system wide expiring timer to ensure >> that no timer event is missed. >>=20 >> Signed-off-by: Anna-Maria Behnsen > > Reviewed-by: Frederic Weisbecker > > Though I must confess I only had a shallow look at group creation (init_g= roup, > get_group, connect_child_parent, setup_groups, add_cpu, and tmigr_init). = But for > the rest, I'm running out of bad scenarios. Time for the rest of the worl= d to > find them! > > Thanks for the hard work! Thank you for your support! Did you saw the v11a for this patch? It is only a cleanup - it removes an unused variable. Just asking, because Review was for plain v11 patch. Thanks, Anna-Maria