From mboxrd@z Thu Jan 1 00:00:00 1970 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 EF23D1D6DBB for ; Wed, 15 Jan 2025 21:12:59 +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=1736975581; cv=none; b=hTsaKfnge6qM+M1LqtE+sfMa87PlsrHGDplf8QIWgRxWQOXjPq4e6oywY9eNyQKSRDSQLegBTBmxztiq4YPJpVhgXaFyJwZiIHWth1s+XSXPiNSc1sU9aBW2/ZkD5gVW6ezvqAkJufGXtZt/h3TCvlxr01B+fsjSl0Cc9Eins2M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736975581; c=relaxed/simple; bh=0Y475DTMV2HffMLw02TEViVBx+givYPdolVX+N8iqs8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=dtzgc6eBFu8cjBlWBVpVicYFmyqPcCf1tHo4ONYYhNUeyT3yRKoVeei4CJhnQpGl89B+80AgIxpAuJdz97qWlMqyOVByzJrDfJf0PLMz3mO4XJhMRNBjx2MVK2+8JWuQv04WRnieScOfPH2POT+Mm5+dwp13CkZRryhuquLLOEI= 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=W3f/7afi; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=uWrx6QWU; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="W3f/7afi"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="uWrx6QWU" From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1736975578; 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: in-reply-to:in-reply-to:references:references; bh=ewig6AF3oLRP8QQeKdRxr6Xov1TDwB1HR+7pRQoQcp0=; b=W3f/7afi78fzc3q2BsIKupZob2SfxBY0ED96vLh1unjNBLm9lVHaqet5m6zlFAXO2xq2YS 1srCgawYxecie44vgaTUrb8P2kpRjIFneOzkiwxG6xVQoOHPk30duoLr9tfuDXnFl8QJU/ 4u7+CbPR8WDXZ+fuuBuaIEpWRHrJ6PTOKIN8feEnuTYiQjBPx+JT0Sufsx3aNOxRlo0Ce3 DdyKdOMLplQfu7Cip0W+2sSqDBbpF2Iy7HXc6DZ8SYmnxFRLLgKI3Fzka05jjTLokYGaTF gUdRifM9hvwkO6ZkT1JhWMzYbQh669F1eF56wQu8VZ+OrxAWmTf6AEfMaFwvHw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1736975578; 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: in-reply-to:in-reply-to:references:references; bh=ewig6AF3oLRP8QQeKdRxr6Xov1TDwB1HR+7pRQoQcp0=; b=uWrx6QWUAWHVt+ErkMVyZQWHbP6iHPsBge3I1I1aJ+ZIakjMqmMuq5SxCoPFaR7Gg8Dj+t 5F4hbw2dCPmm6pDg== To: Zhongqiu Han , anna-maria@linutronix.de, frederic@kernel.org Cc: linux-kernel@vger.kernel.org, quic_zhonhan@quicinc.com Subject: Re: [PATCH] timers: Optimize get_timer_cpu_base() to reduce potentially redundant per_cpu_ptr() calls In-Reply-To: <20241231150115.1978342-1-quic_zhonhan@quicinc.com> References: <20241231150115.1978342-1-quic_zhonhan@quicinc.com> Date: Wed, 15 Jan 2025 22:12:57 +0100 Message-ID: <87h65zbx2e.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Tue, Dec 31 2024 at 23:01, Zhongqiu Han wrote: > If the timer is deferrable and NO_HZ_COMMON is enabled, the function > get_timer_cpu_base() will call per_cpu_ptr() twice. Optimize the function > to avoid potentially redundant per_cpu_ptr() calls. This lacks an explanation for the second hunk which changes get_timer_this_cpu_base(). > One of the call paths of the get_timer_cpu_base() function is through the > lock_timer_base() function, which contains a loop. Within this loop, the > get_timer_base() func is called, and in turn, it calls the > get_timer_cpu_base() function. And in such a path, get_timer_cpu_base is > a hotspot function. It is called approximately 13,000 times in 12 seconds > on test x86 KVM machines. Which is roughly once per millisecond and depending on the number of CPUs that's far from a hotspot. I'm not against the change per se, but this change log is a bit over the top aside of ot mentioning the second hunk. I'll fix it up when applying. Thanks, tglx