From: Borislav Petkov <bp@suse.de>
To: Feng Tang <feng.tang@intel.com>
Cc: "Luck, Tony" <tony.luck@intel.com>,
kernel test robot <rong.a.chen@intel.com>,
LKML <linux-kernel@vger.kernel.org>,
lkp@lists.01.org, Mel Gorman <mgorman@suse.com>
Subject: Re: [LKP] Re: [x86/mce] 1de08dccd3: will-it-scale.per_process_ops -14.1% regression
Date: Fri, 28 Aug 2020 19:48:39 +0200 [thread overview]
Message-ID: <20200828174839.GD19448@zn.tnic> (raw)
In-Reply-To: <20200825062305.GA83850@shbuild999.sh.intel.com>
On Tue, Aug 25, 2020 at 02:23:05PM +0800, Feng Tang wrote:
> Also one good news is, we seem to identify the 2 key percpu variables
> out of the list mentioned in previous email:
> 'arch_freq_scale'
> 'tsc_adjust'
>
> These 2 variables are accessed in 2 hot call stacks (for this 288 CPU
> Xeon Phi platform):
>
> - arch_freq_scale is accessed in scheduler tick
> arch_scale_freq_tick+0xaf/0xc0
> scheduler_tick+0x39/0x100
> update_process_times+0x3c/0x50
> tick_sched_handle+0x22/0x60
> tick_sched_timer+0x37/0x70
> __hrtimer_run_queues+0xfc/0x2a0
> hrtimer_interrupt+0x122/0x270
> smp_apic_timer_interrupt+0x6a/0x150
> apic_timer_interrupt+0xf/0x20
>
> - tsc_adjust is accessed in idle entrance
> tsc_verify_tsc_adjust+0xeb/0xf0
> arch_cpu_idle_enter+0xc/0x20
> do_idle+0x91/0x280
> cpu_startup_entry+0x19/0x20
> start_kernel+0x4f4/0x516
> secondary_startup_64+0xb6/0xc0
>
> From systemmap file, for bad kernel these 2 sit in one cache line, while
> for good kernel they sit in 2 separate cache lines.
>
> It also explains why it turns from a regression to an improvement with
> updated gcc/kconfig, as the cache line sharing situation is reversed.
>
> The direct patch I can think of is to make 'tsc_adjust' cache aligned
> to separate these 2 'hot' variables. How do you think?
>
> --- a/arch/x86/kernel/tsc_sync.c
> +++ b/arch/x86/kernel/tsc_sync.c
> @@ -29,7 +29,7 @@ struct tsc_adjust {
> bool warned;
> };
>
> -static DEFINE_PER_CPU(struct tsc_adjust, tsc_adjust);
> +static DEFINE_PER_CPU_ALIGNED(struct tsc_adjust, tsc_adjust);
So why don't you define both variables with DEFINE_PER_CPU_ALIGNED and
check if all your bad measurements go away this way?
You'd also need to check whether there's no detrimental effect from
this change on other, i.e., !KNL platforms, and I think there won't
be because both variables will be in separate cachelines then and all
should be good.
Hmm?
--
Regards/Gruss,
Boris.
SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg
next prev parent reply other threads:[~2020-08-28 17:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-25 11:44 [x86/mce] 1de08dccd3: will-it-scale.per_process_ops -14.1% regression kernel test robot
2020-04-25 13:01 ` Borislav Petkov
2020-08-18 8:29 ` [LKP] " Feng Tang
2020-08-18 20:06 ` Luck, Tony
2020-08-19 2:04 ` Feng Tang
2020-08-19 2:23 ` Luck, Tony
2020-08-19 3:04 ` Feng Tang
2020-08-19 3:15 ` Feng Tang
2020-08-21 2:02 ` Feng Tang
2020-08-24 15:14 ` Borislav Petkov
2020-08-24 15:33 ` Feng Tang
2020-08-24 15:38 ` Luck, Tony
2020-08-24 15:48 ` Feng Tang
2020-08-24 16:12 ` Borislav Petkov
2020-08-24 16:56 ` Mel Gorman
2020-08-25 6:49 ` Feng Tang
2020-08-25 6:23 ` Feng Tang
2020-08-25 16:44 ` Luck, Tony
2020-08-26 1:45 ` Feng Tang
2020-08-28 17:48 ` Borislav Petkov [this message]
2020-08-31 2:16 ` Feng Tang
2020-08-31 7:56 ` Mel Gorman
2020-08-31 8:23 ` Feng Tang
2020-08-31 8:55 ` Mel Gorman
2020-08-31 12:53 ` Feng Tang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200828174839.GD19448@zn.tnic \
--to=bp@suse.de \
--cc=feng.tang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@lists.01.org \
--cc=mgorman@suse.com \
--cc=rong.a.chen@intel.com \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox