IB/core: added support to use rdma cgroup controller

Added support APIs for IB core to register/unregister every IB/RDMA
device with rdma cgroup for tracking rdma resources.
IB core registers with rdma cgroup controller.
Added support APIs for uverbs layer to make use of rdma controller.
Added uverbs layer to perform resource charge/uncharge functionality.
Added support during query_device uverb operation to ensure it
returns resource limits by honoring rdma cgroup configured limits.

Signed-off-by: Parav Pandit <pandit.parav@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
Parav Pandit
2017-01-10 00:02:14 +00:00
committed by Tejun Heo
parent 39d3e7584a
commit 43579b5f2c
7 changed files with 233 additions and 6 deletions

View File

@@ -60,6 +60,7 @@
#include <linux/atomic.h>
#include <linux/mmu_notifier.h>
#include <linux/uaccess.h>
#include <linux/cgroup_rdma.h>
extern struct workqueue_struct *ib_wq;
extern struct workqueue_struct *ib_comp_wq;
@@ -1331,6 +1332,12 @@ struct ib_fmr_attr {
struct ib_umem;
struct ib_rdmacg_object {
#ifdef CONFIG_CGROUP_RDMA
struct rdma_cgroup *cg; /* owner rdma cgroup */
#endif
};
struct ib_ucontext {
struct ib_device *device;
struct list_head pd_list;
@@ -1363,6 +1370,8 @@ struct ib_ucontext {
struct list_head no_private_counters;
int odp_mrs_count;
#endif
struct ib_rdmacg_object cg_obj;
};
struct ib_uobject {
@@ -1370,6 +1379,7 @@ struct ib_uobject {
struct ib_ucontext *context; /* associated user context */
void *object; /* containing object */
struct list_head list; /* link to context's list */
struct ib_rdmacg_object cg_obj; /* rdmacg object */
int id; /* index into kernel idr */
struct kref ref;
struct rw_semaphore mutex; /* protects .live */
@@ -2118,6 +2128,10 @@ struct ib_device {
struct attribute_group *hw_stats_ag;
struct rdma_hw_stats *hw_stats;
#ifdef CONFIG_CGROUP_RDMA
struct rdmacg_device cg_device;
#endif
/**
* The following mandatory functions are used only at device
* registration. Keep functions such as these at the end of this