diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2014-06-06 17:37:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-06 19:08:13 -0400 |
commit | dcbff5d1effbbd52be1ed9f2efb6c8d0445ad188 (patch) | |
tree | 461ec0551ce11d4fa387a7c93ed317e836697a34 /include/linux/idr.h | |
parent | 15f3ec3f238a44181e1ae85b3cc2c27b9fece01b (diff) |
idr: reorder the fields
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>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/idr.h')
-rw-r--r-- | 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 6af3400b9b2f..013fd9bc4cb6 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h | |||
@@ -29,21 +29,24 @@ | |||
29 | 29 | ||
30 | struct idr_layer { | 30 | struct idr_layer { |
31 | int prefix; /* the ID prefix of this idr_layer */ | 31 | int prefix; /* the ID prefix of this idr_layer */ |
32 | DECLARE_BITMAP(bitmap, IDR_SIZE); /* A zero bit means "space here" */ | 32 | int layer; /* distance from leaf */ |
33 | struct idr_layer __rcu *ary[1<<IDR_BITS]; | 33 | struct idr_layer __rcu *ary[1<<IDR_BITS]; |
34 | int count; /* When zero, we can release it */ | 34 | int count; /* When zero, we can release it */ |
35 | int layer; /* distance from leaf */ | 35 | union { |
36 | struct rcu_head rcu_head; | 36 | /* A zero bit means "space here" */ |
37 | DECLARE_BITMAP(bitmap, IDR_SIZE); | ||
38 | struct rcu_head rcu_head; | ||
39 | }; | ||
37 | }; | 40 | }; |
38 | 41 | ||
39 | struct idr { | 42 | struct idr { |
40 | struct idr_layer __rcu *hint; /* the last layer allocated from */ | 43 | struct idr_layer __rcu *hint; /* the last layer allocated from */ |
41 | struct idr_layer __rcu *top; | 44 | struct idr_layer __rcu *top; |
42 | struct idr_layer *id_free; | ||
43 | int layers; /* only valid w/o concurrent changes */ | 45 | int layers; /* only valid w/o concurrent changes */ |
44 | int id_free_cnt; | ||
45 | int cur; /* current pos for cyclic allocation */ | 46 | int cur; /* current pos for cyclic allocation */ |
46 | spinlock_t lock; | 47 | spinlock_t lock; |
48 | int id_free_cnt; | ||
49 | struct idr_layer *id_free; | ||
47 | }; | 50 | }; |
48 | 51 | ||
49 | #define IDR_INIT(name) \ | 52 | #define IDR_INIT(name) \ |