Messages in this thread Patch in this message | | | From | Michał Winiarski <> | Subject | [PATCH v3 4/4] idr: Add might_alloc() annotation | Date | Tue, 6 Sep 2022 16:01:17 +0200 |
| |
Using might_alloc() lets us catch problems in a deterministic manner, even if we end up not allocating anything.
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> --- lib/radix-tree.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 3c78e1e8b2ad..787ab01001de 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c @@ -23,6 +23,7 @@ #include <linux/preempt.h> /* in_interrupt() */ #include <linux/radix-tree.h> #include <linux/rcupdate.h> +#include <linux/sched/mm.h> #include <linux/slab.h> #include <linux/string.h> #include <linux/xarray.h> @@ -1481,6 +1482,8 @@ void __rcu **idr_get_free(struct radix_tree_root *root, unsigned long maxindex, start = iter->next_index; unsigned int shift, offset = 0; + might_alloc(gfp); + grow: shift = radix_tree_load_root(root, &child, &maxindex); if (!radix_tree_tagged(root, IDR_FREE)) -- 2.37.3
| |