diff options
author | Matthew Wilcox <mawilcox@microsoft.com> | 2016-12-16 11:55:56 -0500 |
---|---|---|
committer | Matthew Wilcox <mawilcox@microsoft.com> | 2017-02-13 21:44:01 -0500 |
commit | 7ad3d4d85c7af9632055a6ac0aa15b6b6a321c6b (patch) | |
tree | 1586a6c01ced64d24c67859d792140853b148d20 /include/linux/idr.h | |
parent | 0a835c4f090af2c76fc2932c539c3b32fd21fbbb (diff) |
ida: Move ida_bitmap to a percpu variable
When we preload the IDA, we allocate an IDA bitmap. Instead of storing
that preallocated bitmap in the IDA, we store it in a percpu variable.
Generally there are more IDAs in the system than CPUs, so this cuts down
on the number of preallocated bitmaps that are unused, and about half
of the IDA users did not call ida_destroy() so they were leaking IDA
bitmaps.
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Diffstat (limited to 'include/linux/idr.h')
-rw-r--r-- | include/linux/idr.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/idr.h b/include/linux/idr.h index f58c0a3addc3..2027c7aba50d 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h @@ -14,6 +14,7 @@ #include <linux/radix-tree.h> #include <linux/gfp.h> +#include <linux/percpu.h> struct idr { struct radix_tree_root idr_rt; @@ -171,9 +172,10 @@ struct ida_bitmap { unsigned long bitmap[IDA_BITMAP_LONGS]; }; +DECLARE_PER_CPU(struct ida_bitmap *, ida_bitmap); + struct ida { struct radix_tree_root ida_rt; - struct ida_bitmap *free_bitmap; }; #define IDA_INIT { \ @@ -193,7 +195,6 @@ void ida_simple_remove(struct ida *ida, unsigned int id); static inline void ida_init(struct ida *ida) { INIT_RADIX_TREE(&ida->ida_rt, IDR_RT_MARKER | GFP_NOWAIT); - ida->free_bitmap = NULL; } /** |