Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1431143
| From | Boqun Feng <boqun.feng@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] locking/osq: Drop the overload of osq lock |
| Date | 2016-06-25 17:20 +0200 |
| Message-ID | <rNXxf-751-3@gated-at.bofh.it> (permalink) |
| References | <rNW89-66B-11@gated-at.bofh.it> <rNWKR-6yX-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Sat, Jun 25, 2016 at 04:24:47PM +0200, Peter Zijlstra wrote:
> On Sat, Jun 25, 2016 at 01:42:03PM -0400, Pan Xinhui wrote:
> > An over-committed guest with more vCPUs than pCPUs has a heavy overload
> > in osq_lock().
> >
> > This is because vCPU A hold the osq lock and yield out, vCPU B wait
> > per_cpu node->locked to be set. IOW, vCPU B wait vCPU A to run and
> > unlock the osq lock. Even there is need_resched(), it did not help on
> > such scenario.
> >
> > To fix such bad issue, add a threshold in one while-loop of osq_lock().
> > The value of threshold is somehow equal to SPIN_THRESHOLD.
>
> Blergh, virt ...
>
> So yes, lock holder preemption sucks. You would also want to limit the
> immediate spin on owner.
>
> Also; I really hate these random number spin-loop thresholds.
>
> Is it at all possible to get feedback from your LPAR stuff that the vcpu
> was preempted? Because at that point we can add do something like:
>
Good point!
>
> int vpc = vcpu_preempt_count();
>
> ...
>
> for (;;) {
>
> /* the big spin loop */
>
> if (need_resched() || vpc != vcpu_preempt_count())
So on PPC, we have lppaca::yield_count to detect when an vcpu is
preempted, if the yield_count is even, the vcpu is running, otherwise it
is preempted(__spin_yield() is a user of this).
Therefore it makes more sense we
if (need_resched() || vcpu_is_preempted(old))
here, and implement vcpu_is_preempted() on PPC as
bool vcpu_is_preempted(int cpu)
{
return !!(be32_to_cpu(lppaca_of(cpu).yield_count) & 1)
}
Thoughts?
Regards,
Boqun
> /* bail */
>
> }
>
>
> With a default implementation like:
>
> static inline int vcpu_preempt_count(void)
> {
> return 0;
> }
>
> So the compiler can make it all go away.
>
>
> But on virt muck it would stop spinning the moment the vcpu gets
> preempted, which is the right moment I'm thinking.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] locking/osq: Drop the overload of osq lock Pan Xinhui <xinhui.pan@linux.vnet.ibm.com> - 2016-06-25 15:50 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Peter Zijlstra <peterz@infradead.org> - 2016-06-25 16:30 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Boqun Feng <boqun.feng@gmail.com> - 2016-06-25 17:20 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Peter Zijlstra <peterz@infradead.org> - 2016-06-25 18:10 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Peter Zijlstra <peterz@infradead.org> - 2016-06-25 18:20 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock panxinhui <xinhui@linux.vnet.ibm.com> - 2016-06-25 19:30 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Peter Zijlstra <peterz@infradead.org> - 2016-06-25 21:20 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock panxinhui <xinhui@linux.vnet.ibm.com> - 2016-06-26 07:00 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Peter Zijlstra <peterz@infradead.org> - 2016-06-27 10:00 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock xinhui <xinhui.pan@linux.vnet.ibm.com> - 2016-06-27 12:30 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Boqun Feng <boqun.feng@gmail.com> - 2016-06-25 18:30 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Peter Zijlstra <peterz@infradead.org> - 2016-06-25 20:30 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Peter Zijlstra <peterz@infradead.org> - 2016-06-25 18:20 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Boqun Feng <boqun.feng@gmail.com> - 2016-06-25 18:50 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock panxinhui <xinhui@linux.vnet.ibm.com> - 2016-06-25 19:30 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Peter Zijlstra <peterz@infradead.org> - 2016-06-25 21:30 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Peter Zijlstra <peterz@infradead.org> - 2016-06-25 21:40 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Boqun Feng <boqun.feng@gmail.com> - 2016-06-26 04:30 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock panxinhui <xinhui@linux.vnet.ibm.com> - 2016-06-26 07:30 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Boqun Feng <boqun.feng@gmail.com> - 2016-06-26 08:10 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock panxinhui <xinhui@linux.vnet.ibm.com> - 2016-06-26 09:00 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Boqun Feng <boqun.feng@gmail.com> - 2016-06-26 16:10 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock panxinhui <xinhui@linux.vnet.ibm.com> - 2016-06-26 18:00 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Boqun Feng <boqun.feng@gmail.com> - 2016-06-26 09:00 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock panxinhui <xinhui@linux.vnet.ibm.com> - 2016-06-26 09:10 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Boqun Feng <boqun.feng@gmail.com> - 2016-06-26 16:30 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock panxinhui <xinhui@linux.vnet.ibm.com> - 2016-06-26 17:20 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Boqun Feng <boqun.feng@gmail.com> - 2016-06-27 08:50 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock xinhui <xinhui.pan@linux.vnet.ibm.com> - 2016-06-27 09:40 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Peter Zijlstra <peterz@infradead.org> - 2016-06-27 10:20 +0200
Re: [PATCH] locking/osq: Drop the overload of osq lock Boqun Feng <boqun.feng@gmail.com> - 2016-06-27 12:30 +0200
csiph-web