[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1706221623230.1885@nanos>
Date: Thu, 22 Jun 2017 16:32:07 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: root <yang.zhang.wz@...il.com>
cc: mingo@...hat.com, hpa@...or.com, pbonzini@...hat.com,
x86@...nel.org, corbet@....net, tony.luck@...el.com, bp@...en8.de,
peterz@...radead.org, mchehab@...nel.org,
akpm@...ux-foundation.org, krzk@...nel.org, jpoimboe@...hat.com,
luto@...nel.org, borntraeger@...ibm.com, thgarnie@...gle.com,
rgerst@...il.com, minipli@...glemail.com,
douly.fnst@...fujitsu.com, nicstange@...il.com, fweisbec@...il.com,
dvlasenk@...hat.com, bristot@...hat.com,
yamada.masahiro@...ionext.com, mika.westerberg@...ux.intel.com,
yu.c.chen@...el.com, aaron.lu@...el.com, rostedt@...dmis.org,
me@...ehuey.com, len.brown@...el.com, prarit@...hat.com,
hidehiro.kawai.ez@...achi.com, fengtiantian@...wei.com,
pmladek@...e.com, jeyu@...hat.com, Larry.Finger@...inger.net,
zijun_hu@....com, luisbg@....samsung.com, johannes.berg@...el.com,
niklas.soderlund+renesas@...natech.se, zlpnobody@...il.com,
adobriyan@...il.com, fgao@...ai8.com, ebiederm@...ssion.com,
subashab@...eaurora.org, arnd@...db.de, matt@...eblueprint.co.uk,
mgorman@...hsingularity.net, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-edac@...r.kernel.org,
kvm@...r.kernel.org
Subject: Re: [PATCH 2/2] x86/idle: use dynamic halt poll
On Thu, 22 Jun 2017, root wrote:
> @@ -962,6 +962,7 @@ __visible void __irq_entry smp_apic_timer_interrupt(struct pt_regs *regs)
> * interrupt lock, which is the WrongThing (tm) to do.
> */
> entering_ack_irq();
> + check_poll();
No way, that we sprinkle this function into every interrupt hotpath. There
are enough genuine ways to do that w/o touching a gazillion of files.
> #ifdef CONFIG_HYPERVISOR_GUEST
> +static unsigned int grow_poll_ns(unsigned int old, unsigned int grow,
> + unsigned int max)
> +{
> + unsigned int val;
> +
> + /* 10us as base poll duration */
> + if (old == 0 && grow)
> + return 10000;
> +
> + val = old * grow;
> + if (val > max)
> + val = max;
> +
> + return val;
> +}
> +
> +static unsigned int shrink_poll_ns(unsigned int old, unsigned int shrink)
> +{
> + if (shrink == 0)
> + return 0;
> +
> + return old / shrink;
> +}
> +
> +void check_poll(void)
> +{
> + unsigned int val, poll_duration;
> + unsigned long begin_ns, now_ns;
> +
> + if (!poll_threshold_ns)
> + return;
If at all then this needs to be a static key based decision.
> +
> + begin_ns = this_cpu_read(poll_begin_ns);
> + /* Not from halt state */
> + if (!begin_ns)
> + return;
If you integrate this stuff into the proper place, then the whole mess goes
away. We really do not need another facility to track idle state. We have
enough already, really.
Thanks,
tglx
Powered by blists - more mailing lists