From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26DC7C4167B for ; Wed, 6 Dec 2023 10:21:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377663AbjLFKU4 (ORCPT ); Wed, 6 Dec 2023 05:20:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377640AbjLFKUy (ORCPT ); Wed, 6 Dec 2023 05:20:54 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BF9B18F for ; Wed, 6 Dec 2023 02:21:00 -0800 (PST) Date: Wed, 6 Dec 2023 11:20:57 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701858059; 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=C45DOZNqHlf6CtGNEEnMCQuBPql4ZJgTYbpJ0anoEpc=; b=kHZjeKMACP4LSXeNS373k9go61+HkPqpxnycDGNdTjvA0+Yc0fudud7Eg/vWERJhxwuATK KfYf2O//1XLTvTxC7aeb7hQj6fF9HwBzOzo6flb/nnrFzOnzJPB1IUIUuFAGzLy8BlqN84 y1rfr7XTUtPue9UAzu8vw92Dv5wu5QqjrO7jCFLzuH4Tsy8Q4BmMWjZ9mEEwsWHetavGTD gbi0werKZBx/po5EJpcdi3zu8gwd89px0MotAiR3/yRwz9OY/tbbbTyuEzJBKYTE8u3Pd9 HdT+LjM4DcLaUF9ApHzMt2V3VzI49+2lQblmAxlvjYlR0RgMW0qI4nDDRPuDng== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701858059; 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=C45DOZNqHlf6CtGNEEnMCQuBPql4ZJgTYbpJ0anoEpc=; b=pJnDOB3fUSN2YgPfX8TmjKgkgMwZcCSWYofRXmuPgVHmKii9e6EQasbkqqfBpPQLAl+r6X ENLJJrIc5PN888Cg== From: Sebastian Siewior To: Anna-Maria Behnsen Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Frederic Weisbecker , Rik van Riel , Steven Rostedt , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Srinivas Pandruvada , K Prateek Nayak Subject: Re: [PATCH v9 24/32] timers: Split out "get next timer interrupt" functionality Message-ID: <20231206102057.RrJjegFf@linutronix.de> References: <20231201092654.34614-1-anna-maria@linutronix.de> <20231201092654.34614-25-anna-maria@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20231201092654.34614-25-anna-maria@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-12-01 10:26:46 [+0100], Anna-Maria Behnsen wrote: > diff --git a/kernel/time/timer.c b/kernel/time/timer.c > index 0d53d853ae22..fc376e06980e 100644 > --- a/kernel/time/timer.c > +++ b/kernel/time/timer.c =E2=80=A6 > +static inline u64 __get_next_timer_interrupt(unsigned long basej, u64 ba= sem, > + bool *idle) > +{ > + struct timer_events tevt =3D { .local =3D KTIME_MAX, .global =3D KTIME_= MAX }; > + struct timer_base *base_local, *base_global; > + unsigned long nextevt; > + u64 expires; > + > + /* > + * Pretend that there is no timer pending if the cpu is offline. > + * Possible pending timers will be migrated later to an active cpu. > + */ > + if (cpu_is_offline(smp_processor_id())) { > + if (idle) > + *idle =3D true; > + return tevt.local; > + } > + > + base_local =3D this_cpu_ptr(&timer_bases[BASE_LOCAL]); > + base_global =3D this_cpu_ptr(&timer_bases[BASE_GLOBAL]); > + > + raw_spin_lock(&base_local->lock); > + raw_spin_lock_nested(&base_global->lock, SINGLE_DEPTH_NESTING); > + > + nextevt =3D fetch_next_timer_interrupt(basej, basem, base_local, > + base_global, &tevt); Now you split it, move it and we have the __forward_timer_base() back in case of the shortcut which is now in fetch_next_timer_interrupt(). All good. > =20 > /* > * We have a fresh next event. Check whether we can forward the Sebastian