From: Rusty Russell <rusty@rustcorp.com.au>
To: Tejun Heo <tj@kernel.org>
Cc: Mark Wu <dwu@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>,
virtualization@lists.linux-foundation.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
Greg Kroah-Hartman <gregkh@suse.de>
Subject: Re: [PATCH 1/1] [virt] virtio-blk: Use ida to allocate disk index
Date: Thu, 16 Jun 2011 09:35:34 +0930 [thread overview]
Message-ID: <87hb7qzlm9.fsf@rustcorp.com.au> (raw)
In-Reply-To: <20110615070638.GI8141@htj.dyndns.org>
On Wed, 15 Jun 2011 09:06:38 +0200, Tejun Heo <tj@kernel.org> wrote:
> It's inherited from idr which was designed to have separate
> prepare/allocation stages so that allocation can happen inside an
> outer spinlock. It doesn't have too much to do with optimization.
> It's mostly to be able to use sleepable context for memory allocation
> while allowing atomic id[ra] allocation.
It might have made sense for a few callers, but as a general mechanism
it stinks. It's a lot of dancing to avoid GFP_ATOMIC allocations; we'd
be better making idr_get_new() take a gfp_t, and have an idr_pre_alloc()
for those who care.
*Sure* there's a chance of racing and we will need to do an atomic
allocation. But can anyone justify the current complexity for all
callers?
> > + * ida_simple_get - get a new id.
> > + * @ida: the (initialized) ida.
> > + * @min_id: the minimum id (inclusive)
> > + * @max_id: the maximum id (inclusive)
> > + *
> > + * Allocates an id in the range min_id <= id <= max_id, or returns -ENOSPC.
> > + * On allocation failure, returns -ENOMEM. This function can sleep.
> > + *
> > + * Use ida_simple_remove() to get rid of an id.
> > + */
> > +int ida_simple_get(struct ida *ida, int min_id, int max_id)
>
> Hmmm... new interface different from existing id[ra] style, but yeah
> something like the above would have made more sense from the
> beginning. The only thing is that isn't (begin <= range < end) more
> conventional form to express ranges?
Yes, but how to express an unlimited range then? I could used unsigned
and 0x80000000, but that seemed crude.
Cheers,
Rusty.
next prev parent reply other threads:[~2011-06-16 1:47 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-01 7:24 [PATCH 1/1] [virt] virtio-blk: Use ida to allocate disk index Mark Wu
2011-06-01 8:25 ` Mark Wu
2011-06-02 10:34 ` Michael S. Tsirkin
2011-06-08 13:12 ` Mark Wu
2011-06-08 13:12 ` Mark Wu
2011-06-02 10:34 ` Michael S. Tsirkin
2011-06-01 8:25 ` Mark Wu
2011-06-01 23:57 ` Rusty Russell
2011-06-01 23:57 ` Rusty Russell
2011-06-08 13:08 ` Mark Wu
2011-06-08 23:21 ` Rusty Russell
2011-06-08 23:21 ` Rusty Russell
2011-06-08 23:45 ` Greg KH
2011-06-08 23:45 ` Greg KH
2011-06-09 9:14 ` Tejun Heo
2011-06-09 9:14 ` Tejun Heo
2011-06-09 10:41 ` Mark Wu
2011-06-15 4:51 ` Rusty Russell
2011-06-15 4:51 ` Rusty Russell
2011-06-15 7:06 ` Tejun Heo
2011-06-15 7:06 ` Tejun Heo
2011-06-16 0:05 ` Rusty Russell [this message]
2011-06-16 7:46 ` Tejun Heo
2011-06-16 7:46 ` Tejun Heo
2011-06-16 0:05 ` Rusty Russell
2011-10-19 10:12 ` Michael S. Tsirkin
2011-10-24 10:02 ` Michael S. Tsirkin
2011-10-24 10:02 ` Jens Axboe
2011-10-25 1:07 ` Rusty Russell
2011-06-09 10:41 ` Mark Wu
2011-06-08 13:08 ` Mark Wu
2011-06-02 10:33 ` Michael S. Tsirkin
2011-06-02 10:33 ` Michael S. Tsirkin
-- strict thread matches above, loose matches on Subject: below --
2011-06-01 7:24 Mark Wu
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=87hb7qzlm9.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=axboe@kernel.dk \
--cc=dwu@redhat.com \
--cc=gregkh@suse.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=tj@kernel.org \
--cc=virtualization@lists.linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.