xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: keir@xen.org, ian.campbell@citrix.com,
	stefano.stabellini@citrix.com, Jan Beulich <JBeulich@suse.com>,
	xen-devel@lists.xenproject.org,
	Malcolm Crossley <malcolm.crossley@citrix.com>
Subject: Re: [PATCH 2/2] grant_table: convert grant table rwlock to percpu rwlock
Date: Thu, 19 Nov 2015 10:09:47 +0000	[thread overview]
Message-ID: <564D9FEB.6020103@citrix.com> (raw)
In-Reply-To: <20151118200211.GE1762@char.us.oracle.com>

On 18/11/15 20:02, Konrad Rzeszutek Wilk wrote:
> On Tue, Nov 17, 2015 at 05:30:59PM +0000, Andrew Cooper wrote:
>> On 17/11/15 17:04, Jan Beulich wrote:
>>>>>> On 03.11.15 at 18:58, <malcolm.crossley@citrix.com> wrote:
>>>> --- a/xen/common/grant_table.c
>>>> +++ b/xen/common/grant_table.c
>>>> @@ -178,6 +178,10 @@ struct active_grant_entry {
>>>>  #define _active_entry(t, e) \
>>>>      ((t)->active[(e)/ACGNT_PER_PAGE][(e)%ACGNT_PER_PAGE])
>>>>  
>>>> +bool_t grant_rwlock_barrier;
>>>> +
>>>> +DEFINE_PER_CPU(rwlock_t *, grant_rwlock);
>>> Shouldn't these be per grant table? And wouldn't doing so eliminate
>>> the main limitation of the per-CPU rwlocks?
>> The grant rwlock is per grant table.
>>
>> The entire point of this series is to reduce the cmpxchg storm which
>> happens when many pcpus attempt to grap the same domains grant read lock.
>>
>> As identified in the commit message, reducing the cmpxchg pressure on
>> the cache coherency fabric increases intra-vm network through from
>> 10Gbps to 50Gbps when running iperf between two 16-vcpu guests.
>>
>> Or in other words, 80% of cpu time is wasted with waiting on an atomic
>> read/modify/write operation against a remote hot cache line.
>>
> Why not use MCE locks then (in Linux the implemention is known
> as qspinlock). Plus they have added extra code to protect against
> recursion (via four levels). See Linux commit
> a33fda35e3a7655fb7df756ed67822afb5ed5e8d
> locking/qspinlock: Introduce a simple generic 4-byte queued spinlock)

The bottlekneck here is the act of taking the read lock, even when it
will be successfully acquired.

There are several good reasons to move to MCS locks (not MCE locks,
which sound somewhat disastrous), but they will not help in the
slightest with this issue.

The optimisation here is to avoid taking the read lock all-together in
the (overwhelmingly) common case.

~Andrew

  parent reply	other threads:[~2015-11-19 10:09 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03 17:58 [PATCH 1/2] rwlock: add per-cpu reader-writer locks Malcolm Crossley
2015-11-03 17:58 ` [PATCH 2/2] grant_table: convert grant table rwlock to percpu rwlock Malcolm Crossley
2015-11-17 17:04   ` Jan Beulich
2015-11-17 17:30     ` Andrew Cooper
2015-11-17 17:39       ` Jan Beulich
2015-11-17 17:53         ` Andrew Cooper
2015-11-18  7:45           ` Jan Beulich
2015-11-18 10:06             ` Andrew Cooper
2015-11-18 10:48               ` Jan Beulich
2015-11-18 10:36           ` Ian Campbell
2015-11-18 10:54             ` Jan Beulich
2015-11-18 11:23               ` Malcolm Crossley
2015-11-18 11:41                 ` Jan Beulich
2015-11-18 11:50                   ` Malcolm Crossley
2015-11-18 11:50                 ` Ian Campbell
2015-11-18 11:56                   ` Malcolm Crossley
2015-11-18 12:07                     ` Ian Campbell
2015-11-18 13:08                       ` Malcolm Crossley
2015-11-18 13:47                         ` Jan Beulich
2015-11-18 14:22                         ` Ian Campbell
2015-11-18 20:02       ` Konrad Rzeszutek Wilk
2015-11-19  9:03         ` Malcolm Crossley
2015-11-19 10:09         ` Andrew Cooper [this message]
2015-11-05 13:48 ` [PATCH 1/2] rwlock: add per-cpu reader-writer locks Marcos E. Matsunaga
2015-11-05 15:20   ` Malcolm Crossley
2015-11-05 15:46     ` Marcos E. Matsunaga
2015-11-17 17:00 ` Jan Beulich
2015-11-18 13:49   ` Malcolm Crossley
2015-11-18 14:15     ` Jan Beulich
2015-11-18 16:21       ` Malcolm Crossley
2015-11-18 17:04         ` Jan Beulich

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=564D9FEB.6020103@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=ian.campbell@citrix.com \
    --cc=keir@xen.org \
    --cc=konrad.wilk@oracle.com \
    --cc=malcolm.crossley@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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;
as well as URLs for NNTP newsgroup(s).