[PATCH rdma-next 2/4] RDMA/core: Support object allocation in atomic context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Leon Romanovsky <leonro@xxxxxxxxxxxx>

AH objects are allocated in atomic context and those allocations should
be done with GFP_ATOMIC. Provide an automatic way to detect the context
in which we are running and allocate accordingly.

Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
---
 include/rdma/ib_verbs.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 3b6eb646066c..a73796581c75 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -59,6 +59,8 @@
 #include <linux/mmu_notifier.h>
 #include <linux/uaccess.h>
 #include <linux/cgroup_rdma.h>
+#include <linux/irqflags.h>
+#include <linux/preempt.h>
 #include <uapi/rdma/ib_user_verbs.h>
 #include <rdma/restrack.h>
 #include <uapi/rdma/rdma_user_ioctl.h>
@@ -2282,7 +2284,8 @@ struct uverbs_attr_bundle;
 				      struct ib_struct)))
 
 #define rdma_zalloc_drv_obj(ib_dev, ib_type)                                   \
-	((struct ib_type *)kzalloc(ib_dev->ops.size_##ib_type, GFP_KERNEL))
+	((struct ib_type *)kzalloc(ib_dev->ops.size_##ib_type,                 \
+		(in_atomic() || in_interrupt()) ? GFP_ATOMIC : GFP_KERNEL))
 
 #define DECLARE_RDMA_OBJ_SIZE(ib_struct) size_t size_##ib_struct
 
-- 
2.20.1





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux