From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 8FBED2E6CDB for ; Tue, 27 Jan 2026 03:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769484298; cv=none; b=fCesX1F+bKaT+tiuQXb+RA2QPQwowF3R4L2Mi0aYSu/BVrsHemhbvOXYLXhZGV5QBYejOf/CJ1wtAtvXgYvOzCJPnryNE+sKJDJOFPRvV8r2Xf9EO5p7/I53jDSalm3nlTSj+4eJM9CmE9654ds6kn3w9YFWHVTAl+ip2iKiHXI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769484298; c=relaxed/simple; bh=cocvWSy/FumFAIjjqASWkT3Cs36b8eKGbX51DeTJtXM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=g3xA/GlqXBeqxdFhRIGjXjSfIi3NxGlJjJcbj5dqYIxVn+LBf+ievcndCwg0rx5nHmZhJu78dGBllrff3tJ7nu7KzN4PM/dxTCH2mLxizg4pNPhv/7Y0AOB4Z88chGFxMGHTAauj/Oe9A2lQc6k6Q95bc1CRe2kX58UOXjpIhs8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gJMBdiT7; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gJMBdiT7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1769484296; x=1801020296; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=cocvWSy/FumFAIjjqASWkT3Cs36b8eKGbX51DeTJtXM=; b=gJMBdiT7JZe5EZANetE5/+Pb3Fn+bQvtYBsKCpZIutx8TgPSc9QaJJ7j /LyCi8j+KSuKWR5pKHga/1RqXJDFR2nqFbszGzGhl0cfnTMCLRXQE9Kez atTInf+JGUfTQXiOSvNeaxFJtszpBj+2/srK09GxTL413ipdp1PIGfzXg CSApmuYfe70eaAzraswiLYPPL/ozSf3AtfaNRoa5HWA0MidheoK1/ID8Q XIvzl1P0MhWiJN+KH0OCdbfBGi1BnVBnYvL1Zvy3S6dE4hSmJcyClkTjw 0xj979v+FtOIqgwRUYMzh10DM50h9bIj/QUG83YgkF3F8NKsHrniPJ5mT g==; X-CSE-ConnectionGUID: c9lyxztOQLKBFeaqxtYtZQ== X-CSE-MsgGUID: DGSD8gPzRl6Astz3lORW7Q== X-IronPort-AV: E=McAfee;i="6800,10657,11683"; a="70565100" X-IronPort-AV: E=Sophos;i="6.21,256,1763452800"; d="scan'208";a="70565100" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2026 19:24:56 -0800 X-CSE-ConnectionGUID: kzaD1PWjSkWAUngh71A65Q== X-CSE-MsgGUID: bIYvVFe0SU2SCslX8qRqTA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,256,1763452800"; d="scan'208";a="238532635" Received: from unknown (HELO [10.238.1.186]) ([10.238.1.186]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2026 19:24:52 -0800 Message-ID: Date: Tue, 27 Jan 2026 11:24:49 +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 v4] sched/clock: Avoid false sharing for sched_clock_irqtime To: Shrikanth Hegde Cc: linux-kernel@vger.kernel.org, Benjamin Lei , Tim Chen , Tianyou Li , K Prateek Nayak , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider References: <20260126021401.1490163-1-wangyang.guo@intel.com> <5d1451b7-bd01-4dac-a32b-9e5c9fe41db7@linux.ibm.com> Content-Language: en-US From: "Guo, Wangyang" In-Reply-To: <5d1451b7-bd01-4dac-a32b-9e5c9fe41db7@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/27/2026 2:45 AM, Shrikanth Hegde wrote: > Hi Wangyang. > > On 1/26/26 7:44 AM, Wangyang Guo wrote: >> Read-mostly sched_clock_irqtime may share the same cacheline with >> frequently updated nohz struct. Make it as static_key to avoid >> false sharing issue. >> >> Details: >> In kernel 6.14, we observed ~3% cycles hotspots in irqtime_account_irq >> when running SPECjbb2015 in a 2-sockets system. Most of cycles spent >> in reading sched_clock_irqtime, which is a read-mostly var. >> > > IMHO, this changelog is meant for latest sched/core. having 6.14 data > won't be > that relevant. > > Also, changelog should be mentioning essence of calling disable in > sched_clock_init_late which was in v3 discussions. > >> perf c2c (cachelien view) shows it has false sharing with nohz struct: >>       Num RmtHitm LclHitm  Offset records             Symbol >>     6.25%   0.00%   0.00%   0x0       4   [k] _nohz_idle_balance.isra.0 >>    18.75% 100.00%   0.00%   0x8      14   [k] nohz_balance_exit_idle >>     6.25%   0.00%   0.00%   0x8       8   [k] nohz_balance_enter_idle >>     6.25%   0.00%   0.00%   0xc       8   [k] sched_balance_newidle >>     6.25%   0.00%   0.00%  0x10      31   [k] nohz_balancer_kick >>     6.25%   0.00%   0.00%  0x20      16   [k] sched_balance_newidle >>    37.50%   0.00%   0.00%  0x38      50   [k] irqtime_account_irq >>     6.25%   0.00%   0.00%  0x38      47   [k] account_process_tick >>     6.25%   0.00%   0.00%  0x38      12   [k] account_idle_ticks >> >> Offsets: >> *  0x0 -- nohz.idle_cpu_mask (r) >> *  0x8 -- nohz.nr_cpus (w) >> * 0x38 -- sched_clock_irqtime (r), not in nohz, but share cacheline >> >> The layout in /proc/kallsyms can also confirm that: >> ffffffff88600d40 b nohz >> ffffffff88600d68 B arch_needs_tick_broadcast >> ffffffff88600d6c b __key.264 >> ffffffff88600d6c b __key.265 >> ffffffff88600d70 b dl_generation >> ffffffff88600d78 b sched_clock_irqtime >> >> With the patch applied, irqtime_account_irq hotspot disappear. >> >> --- > > Please dont put a --- here. > > git am will strip everything after this and actual diff. So the your > signed-off-by and other details won't be captured. > > If the intention was keep version history, put it after the signed-off-by > for example: > https://lore.kernel.org/lkml/20260120113246.27987-2-kprateek.nayak@amd.com/ Changelog updated in v5: https://lore.kernel.org/all/20260127031602.1907377-1-wangyang.guo@intel.com/ BR Wangyang