xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Matt Wilson <msw@linux.com>, xen-devel@lists.xenproject.org
Cc: "Felipe Franciosi" <felipe.franciosi@citrix.com>,
	"Anthony Liguori" <aliguori@amazon.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"David Vrabel" <david.vrabel@citrix.com>,
	"Jan Beulich" <JBeulich@suse.com>, "Matt Wilson" <msw@amazon.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [RFC PATCH 2/2] gnttab: refactor locking for better scalability
Date: Tue, 12 Nov 2013 05:37:08 +0000	[thread overview]
Message-ID: <CEA76F04.64C60%keir.xen@gmail.com> (raw)
In-Reply-To: <1384221792-3456-3-git-send-email-msw@linux.com>

On 12/11/2013 02:03, "Matt Wilson" <msw@linux.com> wrote:

> + Locking
> + ~~~~~~~
> + Xen uses several locks to serialize access to the internal grant table
> state.
> +
> +  grant_table->lock          : rwlock used to prevent readers from accessing
> +                               inconsistent grant table state such as current
> +                               version, partially initialized active table
> pages,
> +                               etc.
> +  grant_table->maptrack_lock : spinlock used to protect the maptrack state
> +  active_grant_entry->lock   : spinlock used to serialize modifications to
> +                               active entries
> +
> + The primary lock for the grant table is a read/write spinlock. All
> + functions that access members of struct grant_table must acquire a
> + read lock around critical sections. Any modification to the members
> + of struct grant_table (e.g., nr_status_frames, nr_grant_frames,
> + active frames, etc.) must only be made if the write lock is
> + held. These elements are read-mostly, and read critical sections can
> + be large, which makes a rwlock a good choice.

Is there any concern about writer starvation here? I know our spinlocks
aren't 'fair' but our rwlocks are guaranteed to starve out writers if there
is a steady continuous stream of readers. Perhaps we should write-bias our
rwlock, or at least make that an option. We could get fancier but would
probably hurt performance.

Looks like great work however!

 -- Keir

  reply	other threads:[~2013-11-12  5:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-12  2:03 [RFC PATCH 0/2] gnttab: refactor locking for better scalability Matt Wilson
2013-11-12  2:03 ` [RFC PATCH 1/2] gnttab: lock the local grant table earlier in __gnttab_unmap_common() Matt Wilson
2013-11-12  2:03 ` [RFC PATCH 2/2] gnttab: refactor locking for better scalability Matt Wilson
2013-11-12  5:37   ` Keir Fraser [this message]
2013-11-12  7:18     ` Matt Wilson
2013-11-12  8:07       ` Keir Fraser
2013-11-12  9:18         ` Jan Beulich
2013-11-12 13:42           ` Keir Fraser
2013-11-12 13:58             ` Keir Fraser
2013-11-12 14:11               ` Jan Beulich
2013-11-12 14:24                 ` Keir Fraser
2013-11-12 15:09                   ` Felipe Franciosi
2014-06-20 20:54                   ` Konrad Rzeszutek Wilk
2014-06-20 21:18                     ` Matt Wilson
2013-11-12 19:06         ` Matt Wilson
2013-11-12 14:52       ` Konrad Rzeszutek Wilk
2013-11-12 15:04         ` David Vrabel
2013-11-12 16:53           ` Anthony Liguori
2013-11-12  9:26   ` Jan Beulich
2013-11-12 17:58     ` Matt Wilson
2013-11-13  7:39       ` Jan Beulich
  -- strict thread matches above, loose matches on Subject: below --
2014-06-21  0:13 Konrad Rzeszutek Wilk

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=CEA76F04.64C60%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --cc=JBeulich@suse.com \
    --cc=aliguori@amazon.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=felipe.franciosi@citrix.com \
    --cc=msw@amazon.com \
    --cc=msw@linux.com \
    --cc=roger.pau@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).