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


Groups > linux.kernel > #1406541

Re: [PATCH v4] KVM: halt-polling: poll for the upcoming fire timers

From Wanpeng Li <kernellwp@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4] KVM: halt-polling: poll for the upcoming fire timers
Date 2016-05-25 02:50 +0200
Message-ID <rCvbj-2gr-1@gated-at.bofh.it> (permalink)
References <rCfpU-sX-13@gated-at.bofh.it> <rCt9v-R2-15@gated-at.bofh.it> <rCtMd-1kg-7@gated-at.bofh.it> <rCu5A-1sd-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


2016-05-25 7:37 GMT+08:00 David Matlack <dmatlack@google.com>:
> On Tue, May 24, 2016 at 4:11 PM, Wanpeng Li <kernellwp@gmail.com> wrote:
>> 2016-05-25 6:38 GMT+08:00 David Matlack <dmatlack@google.com>:
>>> On Tue, May 24, 2016 at 12:57 AM, Wanpeng Li <kernellwp@gmail.com> wrote:
>>>> From: Wanpeng Li <wanpeng.li@hotmail.com>
>>>>
>>>> If an emulated lapic timer will fire soon(in the scope of 10us the
>>>> base of dynamic halt-polling, lower-end of message passing workload
>>>> latency TCP_RR's poll time < 10us) we can treat it as a short halt,
>>>> and poll to wait it fire, the fire callback apic_timer_fn() will set
>>>> KVM_REQ_PENDING_TIMER, and this flag will be check during busy poll.
>>>> This can avoid context switch overhead and the latency which we wake
>>>> up vCPU.
>>>>
>>>> This feature is slightly different from current advance expiration
>>>> way. Advance expiration rely on the vCPU is running(do polling before
>>>> vmentry). But in some cases, the timer interrupt may be blocked by
>>>> other thread(i.e., IF bit is clear) and vCPU cannot be scheduled to
>>>> run immediately. So even advance the timer early, vCPU may still see
>>>> the latency. But polling is different, it ensures the vCPU to aware
>>>> the timer expiration before schedule out.
>>>>
>>>> echo HRTICK > /sys/kernel/debug/sched_features in dynticks guests.


                    ^^^^^^^^^^^^^^^^^

>>>>
>>>> Context switching - times in microseconds - smaller is better
>>>> -------------------------------------------------------------------------
>>>> Host                 OS  2p/0K 2p/16K 2p/64K 8p/16K 8p/64K 16p/16K 16p/64K
>>>>                          ctxsw  ctxsw  ctxsw ctxsw  ctxsw   ctxsw   ctxsw
>>>> --------- ------------- ------ ------ ------ ------ ------ ------- -------
>>>> kernel     Linux 4.6.0+ 7.9800   11.0   10.8   14.6 9.4300    13.0    10.2 vanilla
>>>> kernel     Linux 4.6.0+   15.3   13.6   10.7   12.5 9.0000    12.8 7.38000 poll
>>>
>>> These results aren't very compelling. Sometimes polling is faster,
>>> sometimes vanilla is faster, sometimes they are about the same.
>>
>> More processes and bigger cache footprints can get benefit from the
>> result since I open the hrtimer for the precision preemption.
>
> The VCPU is halted (idle), so the timer interrupt is not preempting
> anything. Also I would not expect any preemption in a context
> switching benchmark, the threads should be handing off execution to
> one another.
>
> I'm confused why timers would play any role in the performance of this
> benchmark. Any idea why there's a speedup in the 8p/16K and 16p/64K
> runs?

https://lwn.net/Articles/254512/, I open HRTICK for high-res
preemption tick in dynticks guests instead of host. So task switch
will trigger by hrtimer fire in guests.

Regards,
Wanpeng Li

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


Thread

[PATCH v4] KVM: halt-polling: poll for the upcoming fire timers Wanpeng Li <kernellwp@gmail.com> - 2016-05-24 10:00 +0200
  Re: [PATCH v4] KVM: halt-polling: poll for the upcoming fire timers Christian Borntraeger <borntraeger@de.ibm.com> - 2016-05-24 19:20 +0200
    Re: [PATCH v4] KVM: halt-polling: poll for the upcoming fire timers Wanpeng Li <kernellwp@gmail.com> - 2016-05-25 01:20 +0200
  Re: [PATCH v4] KVM: halt-polling: poll for the upcoming fire timers David Matlack <dmatlack@google.com> - 2016-05-25 00:40 +0200
    Re: [PATCH v4] KVM: halt-polling: poll for the upcoming fire timers Wanpeng Li <kernellwp@gmail.com> - 2016-05-25 01:20 +0200
      Re: [PATCH v4] KVM: halt-polling: poll for the upcoming fire timers David Matlack <dmatlack@google.com> - 2016-05-25 01:40 +0200
        Re: [PATCH v4] KVM: halt-polling: poll for the upcoming fire timers Wanpeng Li <kernellwp@gmail.com> - 2016-05-25 02:50 +0200
          Re: [PATCH v4] KVM: halt-polling: poll for the upcoming fire timers Wanpeng Li <kernellwp@gmail.com> - 2016-05-25 03:30 +0200
        Re: [PATCH v4] KVM: halt-polling: poll for the upcoming fire timers Yang Zhang <yang.zhang.wz@gmail.com> - 2016-05-25 04:20 +0200

csiph-web