From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Tejun Heo <tj@kernel.org>, Lai Jiangshan <laijs@cn.fujitsu.com>,
Vladimir Davydov <vdavydov@parallels.com>,
Jiri Kosina <jkosina@suse.cz>, Jeff Layton <jlayton@redhat.com>,
Andreas Gruenbacher <agruen@linbit.com>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 4/4] idr: reorder the fields
Date: Tue, 22 Apr 2014 18:16:21 +0800 [thread overview]
Message-ID: <1398161781-12105-5-git-send-email-laijs@cn.fujitsu.com> (raw)
In-Reply-To: <1398161781-12105-1-git-send-email-laijs@cn.fujitsu.com>
idr_layer->layer is always accessed in read path,
move it in the front.
idr_layer->bitmap is moved on the bottom. And
rcu_head shares with bitmap due to they do not
be accessed at the same time.
idr->id_free/id_free_cnt/lock are free list fields,
and moved to the bottom. They will be removed
in near future.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
include/linux/idr.h | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 3a77b33..c537c55 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -29,21 +29,24 @@
struct idr_layer {
int prefix; /* the ID prefix of this idr_layer */
- DECLARE_BITMAP(bitmap, IDR_SIZE); /* A zero bit means "space here" */
+ int layer; /* distance from leaf */
struct idr_layer __rcu *ary[1<<IDR_BITS];
int count; /* When zero, we can release it */
- int layer; /* distance from leaf */
- struct rcu_head rcu_head;
+ union {
+ /* A zero bit means "space here" */
+ DECLARE_BITMAP(bitmap, IDR_SIZE);
+ struct rcu_head rcu_head;
+ };
};
struct idr {
struct idr_layer __rcu *hint; /* the last layer allocated from */
struct idr_layer __rcu *top;
- struct idr_layer *id_free;
int layers; /* only valid w/o concurrent changes */
- int id_free_cnt;
int cur; /* current pos for cyclic allocation */
spinlock_t lock;
+ int id_free_cnt;
+ struct idr_layer *id_free;
};
#define IDR_INIT(name) \
--
1.7.4.4
prev parent reply other threads:[~2014-04-22 10:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-22 10:16 [PATCH 0/4] idr: idr cleanups Lai Jiangshan
2014-04-22 10:16 ` [PATCH 1/4] idr: proper invalid argument handling Lai Jiangshan
2014-04-22 19:16 ` Andrew Morton
2014-04-22 19:46 ` Andrew Morton
2014-04-22 19:54 ` Tejun Heo
2014-04-22 10:16 ` [PATCH 2/4] idr: reduce the number of MAX_IDR_FREE Lai Jiangshan
2014-04-22 19:58 ` Tejun Heo
2014-04-23 1:55 ` Lai Jiangshan
2014-04-22 10:16 ` [PATCH 3/4] ida: in-place ida allocation Lai Jiangshan
2014-04-22 20:02 ` Tejun Heo
2014-04-23 1:44 ` Lai Jiangshan
2014-04-22 10:16 ` Lai Jiangshan [this message]
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=1398161781-12105-5-git-send-email-laijs@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=agruen@linbit.com \
--cc=akpm@linux-foundation.org \
--cc=jkosina@suse.cz \
--cc=jlayton@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=tj@kernel.org \
--cc=vdavydov@parallels.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
all inboxes | Powered by JetHome®