From: "Michał Winiarski" <michal.winiarski@intel.com>
To: <dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Cc: "Michał Winiarski" <michal.winiarski@intel.com>,
"David Airlie" <airlied@linux.ie>,
"Matthew Wilcox" <willy@infradead.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>
Subject: [PATCH v3 4/4] idr: Add might_alloc() annotation
Date: Tue, 6 Sep 2022 16:01:17 +0200 [thread overview]
Message-ID: <20220906140117.409852-5-michal.winiarski@intel.com> (raw)
In-Reply-To: <20220906140117.409852-1-michal.winiarski@intel.com>
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
next prev parent reply other threads:[~2022-09-06 14:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-06 14:01 [PATCH v3 0/4] drm: Use full allocated minor range for DRM Michał Winiarski
2022-09-06 14:01 ` [PATCH v3 1/4] drm: Expand max DRM device number to full MINORBITS Michał Winiarski
2022-09-06 14:01 ` [PATCH v3 2/4] drm: Introduce skip_legacy_minors modparam Michał Winiarski
2022-09-06 14:01 ` [PATCH v3 3/4] drm: Use mutex for minors Michał Winiarski
2022-09-06 14:01 ` Michał Winiarski [this message]
2022-09-06 14:21 ` [PATCH v3 0/4] drm: Use full allocated minor range for DRM Matthew Wilcox
2022-09-06 16:08 ` Michał Winiarski
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=20220906140117.409852-5-michal.winiarski@intel.com \
--to=michal.winiarski@intel.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tzimmermann@suse.de \
--cc=willy@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).