Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1673218

Re: [PATCH 2/2] x86/idle: use dynamic halt poll

From Yang Zhang <yang.zhang.wz@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] x86/idle: use dynamic halt poll
Date 2017-06-23 06:10 +0200
Message-ID <tVo4W-5HP-15@gated-at.bofh.it> (permalink)
References <tV8tb-3Zd-3@gated-at.bofh.it> <tV8tb-3Zd-7@gated-at.bofh.it> <tVbr3-5Yi-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2017/6/22 22:32, Thomas Gleixner wrote:
> 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.

I will find a more correct place to call this function.

>
>>  #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.

Sure, will do it.

>
>> +
>> +	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.

Agree, I will check current code to find a more proper way to do the check.

>
> Thanks,
>
> 	tglx
>


-- 
Yang
Alibaba Cloud Computing

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] x86/idle: add halt poll support root <yang.zhang.wz@gmail.com> - 2017-06-22 13:30 +0200
  [PATCH 1/2] x86/idle: add halt poll for halt idle root <yang.zhang.wz@gmail.com> - 2017-06-22 13:30 +0200
    Re: [PATCH 1/2] x86/idle: add halt poll for halt idle Thomas Gleixner <tglx@linutronix.de> - 2017-06-22 16:30 +0200
      Re: [PATCH 1/2] x86/idle: add halt poll for halt idle Yang Zhang <yang.zhang.wz@gmail.com> - 2017-06-23 06:10 +0200
  [PATCH 2/2] x86/idle: use dynamic halt poll root <yang.zhang.wz@gmail.com> - 2017-06-22 13:30 +0200
    Re: [PATCH 2/2] x86/idle: use dynamic halt poll Paolo Bonzini <pbonzini@redhat.com> - 2017-06-22 14:00 +0200
      Re: [PATCH 2/2] x86/idle: use dynamic halt poll Yang Zhang <yang.zhang.wz@gmail.com> - 2017-06-23 06:00 +0200
        Re: [PATCH 2/2] x86/idle: use dynamic halt poll Yang Zhang <yang.zhang.wz@gmail.com> - 2017-06-27 13:30 +0200
          Re: [PATCH 2/2] x86/idle: use dynamic halt poll Paolo Bonzini <pbonzini@redhat.com> - 2017-06-27 14:10 +0200
            Re: [PATCH 2/2] x86/idle: use dynamic halt poll Wanpeng Li <kernellwp@gmail.com> - 2017-06-27 14:30 +0200
              Re: [PATCH 2/2] x86/idle: use dynamic halt poll Paolo Bonzini <pbonzini@redhat.com> - 2017-06-27 14:30 +0200
                Re: [PATCH 2/2] x86/idle: use dynamic halt poll Radim Krčmář <rkrcmar@redhat.com> - 2017-06-27 15:50 +0200
                Re: [PATCH 2/2] x86/idle: use dynamic halt poll Paolo Bonzini <pbonzini@redhat.com> - 2017-06-27 16:00 +0200
                Re: [PATCH 2/2] x86/idle: use dynamic halt poll Paolo Bonzini <pbonzini@redhat.com> - 2017-06-27 16:30 +0200
                Re: [PATCH 2/2] x86/idle: use dynamic halt poll Radim Krčmář <rkrcmar@redhat.com> - 2017-06-27 16:30 +0200
                Re: [PATCH 2/2] x86/idle: use dynamic halt poll Yang Zhang <yang.zhang.wz@gmail.com> - 2017-07-03 11:30 +0200
                Re: [PATCH 2/2] x86/idle: use dynamic halt poll Thomas Gleixner <tglx@linutronix.de> - 2017-07-03 12:10 +0200
    Re: [PATCH 2/2] x86/idle: use dynamic halt poll Thomas Gleixner <tglx@linutronix.de> - 2017-06-22 16:40 +0200
      Re: [PATCH 2/2] x86/idle: use dynamic halt poll Yang Zhang <yang.zhang.wz@gmail.com> - 2017-06-23 06:10 +0200
    Re: [PATCH 2/2] x86/idle: use dynamic halt poll kbuild test robot <lkp@intel.com> - 2017-06-23 00:50 +0200
  Re: [PATCH 0/2] x86/idle: add halt poll support Yang Zhang <yang.zhang.wz@gmail.com> - 2017-06-22 13:40 +0200
  Re: [PATCH 0/2] x86/idle: add halt poll support Wanpeng Li <kernellwp@gmail.com> - 2017-06-22 14:00 +0200
    Re: [PATCH 0/2] x86/idle: add halt poll support Yang Zhang <yang.zhang.wz@gmail.com> - 2017-06-23 06:10 +0200
      Re: [PATCH 0/2] x86/idle: add halt poll support Wanpeng Li <kernellwp@gmail.com> - 2017-06-23 06:40 +0200
        Re: [PATCH 0/2] x86/idle: add halt poll support Yang Zhang <yang.zhang.wz@gmail.com> - 2017-06-23 08:50 +0200
          Re: [PATCH 0/2] x86/idle: add halt poll support Radim Krčmář <rkrcmar@redhat.com> - 2017-06-27 16:10 +0200

csiph-web