linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Kent Overstreet <koverstreet@google.com>
Cc: Dmitry Torokhov <dtor@vmware.com>,
	David Airlie <airlied@linux.ie>,
	Davidlohr Bueso <davidlohr.bueso@hp.com>,
	Trond Myklebust <Trond.Myklebust@netapp.com>,
	nab@linux-iscsi.org, Sean Hefty <sean.hefty@intel.com>,
	Michel Lespinasse <walken@google.com>,
	John McCutchan <john@johnmccutchan.com>,
	Roland Dreier <roland@kernel.org>,
	Thomas Hellstrom <thellstrom@vmware.com>,
	linux1394-devel@lists.sourceforge.net,
	linux-scsi@vger.kernel.org, Robert Love <rlove@rlove.org>,
	linux-rdma@vger.kernel.org, cluster-devel@redhat.com,
	Stefan Richter <stefanr@s5r6.in-berlin.de>,
	Brian Paul <brianp@vmware.com>,
	Doug Gilbert <dgilbert@interlog.com>,
	Dave Airlie <airlied@redhat.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	Rik van Riel <riel@redhat.com>,
	Erez Shitrit <erezsh@mellanox.co.il>
Subject: Re: [PATCH 10/10] idr: Rework idr_preload()
Date: Wed, 19 Jun 2013 01:18:32 -0700	[thread overview]
Message-ID: <20130619081832.GC30681@mtj.dyndns.org> (raw)
In-Reply-To: <1371600150-23557-11-git-send-email-koverstreet@google.com>

Hello, Kent.

On Tue, Jun 18, 2013 at 05:02:30PM -0700, Kent Overstreet wrote:
> With the new ida implementation, that doesn't work anymore - the new ida
> code grows its bitmap tree by reallocating the entire thing in power of
> two increments. Doh.

So, I'm not sure about the single contiguous array implementation.  It
introduces some nasty characteristics such as possibly too large
contiguous allocation, bursty CPU usages, and loss of the ability to
handle ID allocations clustered in high areas - sure, the old ida
wasn't great on that part either but this can be much worse.

In addition, I'm not sure what this single contiguous allocation buys
us.  Let's say each leaf node size is 4k.  Even with in-array tree
implementation, it should be able to serve 2k IDs per-page, which
would be enough for most use cases and with a bit of caching it can
easily achieve both the performance benefits of array implementation
and the flexibility of allocating each leaf separately.  Even without
caching, the tree depth would normally be much lower than the current
implementation and the performance should be better.  If you're
bothered by having to implement another radix tree for it, it should
be possible to just implement the leaf node logic and use the existing
radix tree for internal nodes, right?

> So we need a slightly different trick. Note that if all allocations from
> an idr start by calling idr_prealloc() and disabling premption, at
> most nr_cpus() allocations can happen before someone calls
> idr_prealloc() again.

But we allow mixing preloaded and normal allocations and users are
allowed to allocate as many IDs they want after preloading.  It should
guarantee that the first allocation after preloading follows the
stronger allocation flag, and the above approach can't guarantee that.
You can declare that if preload is to work, all allocators of the ida
should preload and enforce it but that restriction arises only because
you're using this single array implementation.  It's another drawback
of this particular approach.  There seem to be a lot of cons and I
can't really see what the pros are.

Thanks.

-- 
tejun

  reply	other threads:[~2013-06-19  8:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1371600150-23557-1-git-send-email-koverstreet@google.com>
     [not found] ` <1371600150-23557-1-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2013-06-19  0:02   ` [PATCH 09/10] idr: Remove unneeded idr locking, idr_preload() usage Kent Overstreet
2013-06-19  0:02 ` [PATCH 10/10] idr: Rework idr_preload() Kent Overstreet
2013-06-19  8:18   ` Tejun Heo [this message]
2013-06-19 23:33     ` Kent Overstreet
2013-06-19 23:46       ` Tejun Heo
     [not found] <1373087301-23730-1-git-send-email-kmo@daterainc.com>
2013-07-06  5:08 ` Kent Overstreet
     [not found] <1375896905-6074-1-git-send-email-kmo@daterainc.com>
2013-08-07 17:46 ` Kent Overstreet

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=20130619081832.GC30681@mtj.dyndns.org \
    --to=tj@kernel.org \
    --cc=Trond.Myklebust@netapp.com \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=brianp@vmware.com \
    --cc=cluster-devel@redhat.com \
    --cc=davidlohr.bueso@hp.com \
    --cc=dgilbert@interlog.com \
    --cc=dtor@vmware.com \
    --cc=erezsh@mellanox.co.il \
    --cc=hal.rosenstock@gmail.com \
    --cc=john@johnmccutchan.com \
    --cc=koverstreet@google.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=nab@linux-iscsi.org \
    --cc=riel@redhat.com \
    --cc=rlove@rlove.org \
    --cc=roland@kernel.org \
    --cc=sean.hefty@intel.com \
    --cc=stefanr@s5r6.in-berlin.de \
    --cc=thellstrom@vmware.com \
    --cc=walken@google.com \
    /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).