From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 775A34C85 for ; Thu, 16 Jan 2025 03:37:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736998627; cv=none; b=P5qj54XR8cLWMViMZ4vUjhCFuqXbYDAMeu8bFONdM86RpfQz25100v9n8hgzOUVZYOr6BlH8gyepekz2KfH55Ckrtda+t02iz0XzLdbLt659mVtNSjYKpWAP7BRbPfgGU3eFQjKEgspnBjQBL1pAIrYOM4TQWBaERCHFFn5uN3k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736998627; c=relaxed/simple; bh=Ps2os+nZtraHhM+Qgf8S70wa7qBt1RxgL09xzsiGOSY=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=EZ3dpiO+5IcJODPDmJQjQu6dyXKtsyWqtf7h4nNYVxm+lYtYgygIb7P+JuEht8N0u7AQF1Lsn1GG0vW92NLQlQGBHtzalEaBTYUl5IRAXRbCGnKdxskOcvgx+xvnIb8WjAgnsVRCJbxx84cPNy75KlWDD2aZeL6Rp1+iYdFjkwY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=HM8jTqFD; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="HM8jTqFD" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50FGnGkx014343; Thu, 16 Jan 2025 03:36:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= eQrBGPsOWUeC6lZdIC0LX2lY40jpi+aiWZDXzwC81CA=; b=HM8jTqFD7OihLi6e pJNE3xykdt0zjPyPgAtDFkJ+pxUnpnOdxQ1VUTx9+7zrt3oH3ZJyeQV1pgCDNW8D OTGlOFHAr+7ztlOrcIYaH7hUzrYgI/EuDFZPr0fWw4UptWn/OBdkUxehlaczPvB/ V7+h1VxEeQ7IlycvLeUACSBeYTRc/yO5LRgqgtRCtTTbqGf4JDloyHUWAw5RQhk4 zGUtaACYX5d03B899bPaP+aW7VvwvC/ZAuVrXgS2l9zFrZPBSPUb4S+qzzwrPnHc yVGULU+L/D8PLxefsf+Pta0tlVkMiixPnLcn/XMS6eh8deRdbSZrr3g1ZmwXPNoj glISBw== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 446fh21gw9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Jan 2025 03:36:52 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 50G3apsB015199 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Jan 2025 03:36:51 GMT Received: from [10.239.133.66] (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 15 Jan 2025 19:36:49 -0800 Message-ID: <62582edd-d4ff-4e7b-b296-cd6dcf520160@quicinc.com> Date: Thu, 16 Jan 2025 11:36:41 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] timers: Optimize get_timer_cpu_base() to reduce potentially redundant per_cpu_ptr() calls To: Thomas Gleixner , , CC: References: <20241231150115.1978342-1-quic_zhonhan@quicinc.com> <87h65zbx2e.ffs@tglx> Content-Language: en-US From: Zhongqiu Han In-Reply-To: <87h65zbx2e.ffs@tglx> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: mblz260AUb2LooJAy7I2RGdAJ7AAms4i X-Proofpoint-GUID: mblz260AUb2LooJAy7I2RGdAJ7AAms4i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-16_01,2025-01-15_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=983 clxscore=1015 lowpriorityscore=0 suspectscore=0 phishscore=0 impostorscore=0 spamscore=0 priorityscore=1501 adultscore=0 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501160022 On 1/16/2025 5:12 AM, Thomas Gleixner wrote: > 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(). > Acknowledged. >> 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. Acknowledged. > > 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 Hi tglx / Frederic, Thanks for the review. Since you will help modify the commit message when applying, I will not arise patchset2. Thanks~ -- Thx and BRs, Zhongqiu Han