From: Tejun Heo <tj@kernel.org>
To: "Hefty, Sean" <sean.hefty@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Rusty Russell <rusty@rustcorp.com.au>,
Jean Delvare <khali@linux-fr.org>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
Roland Dreier <roland@kernel.org>,
Hal Rosenstock <hal.rosenstock@gmail.com>,
"Marciniszyn, Mike" <mike.marciniszyn@intel.com>,
Jack Morgenstein <jackm@dev.mellanox.co.il>,
Or Gerlitz <ogerlitz@mellanox.com>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH 2/6] idr: remove MAX_IDR_MASK and move left MAX_IDR_* into idr.c
Date: Sat, 9 Feb 2013 11:00:37 -0800 [thread overview]
Message-ID: <20130209190037.GB2875@htj.dyndns.org> (raw)
In-Reply-To: <1828884A29C6694DAF28B7E6B8A8237357D44677@ORSMSX101.amr.corp.intel.com>
Hello,
On Fri, Feb 08, 2013 at 10:09:13PM +0000, Hefty, Sean wrote:
> > Used to wrap cyclic @start. Can be replaced with max(next, 0).
> > Note that this type of cyclic allocation using idr is buggy. These
> > are prone to spurious -ENOSPC failure after the first wraparound.
>
> The replacement code looks fine, but can you explain why the use is buggy?
So, if you want a cyclic allocation, the allocation should be tried in
[start, END) and then [0, start); otherwise, after the allocation
wraps for the first time, as the closer the starting point gets to
END, the chance of not finding a vacant slot in [start, END) goes
higher. When @start equals END - 1 for the second time, if the first
END - 1 allocation is still around, you'll get -ENOSPC.
In practice, I don't think anyone is hitting this. idr has always
been horribly broken when it reaches higher range (> 1<<30 on 64bit)
so things would have broken even before the first wraparound. It
still is a theoretical possibility which may trigger if idr is used
for, say, ipc messages or storage commands.
Thanks.
--
tejun
next prev parent reply other threads:[~2013-02-09 19:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-08 21:00 [PATCH 1/6] idr: fix top layer handling Tejun Heo
2013-02-08 21:01 ` [PATCH 2/6] idr: remove MAX_IDR_MASK and move left MAX_IDR_* into idr.c Tejun Heo
2013-02-08 22:09 ` Hefty, Sean
2013-02-09 19:00 ` Tejun Heo [this message]
2013-02-10 21:19 ` Hefty, Sean
2013-02-10 11:52 ` Wolfram Sang
2013-02-08 21:02 ` [PATCH 3/6] idr: remove length restriction from idr_layer->bitmap Tejun Heo
2013-02-08 21:03 ` [PATCH 4/6] idr: make idr_layer larger Tejun Heo
2013-02-08 21:03 ` [PATCH 5/6] idr: add idr_layer->prefix Tejun Heo
2013-02-08 21:03 ` [PATCH 6/6] idr: implement lookup hint Tejun Heo
2013-02-11 23:39 ` [PATCH 1/6] idr: fix top layer handling Andrew Morton
2013-02-12 17:10 ` Tejun Heo
2013-02-12 21:23 ` Andrew Morton
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=20130209190037.GB2875@htj.dyndns.org \
--to=tj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hal.rosenstock@gmail.com \
--cc=jackm@dev.mellanox.co.il \
--cc=khali@linux-fr.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mike.marciniszyn@intel.com \
--cc=ogerlitz@mellanox.com \
--cc=roland@kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=sean.hefty@intel.com \
--cc=viro@zeniv.linux.org.uk \
/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