118 lines · plain
1===============2RDMA Controller3===============4 5.. Contents6 7 1. Overview8 1-1. What is RDMA controller?9 1-2. Why RDMA controller needed?10 1-3. How is RDMA controller implemented?11 2. Usage Examples12 131. Overview14===========15 161-1. What is RDMA controller?17-----------------------------18 19RDMA controller allows user to limit RDMA/IB specific resources that a given20set of processes can use. These processes are grouped using RDMA controller.21 22RDMA controller defines two resources which can be limited for processes of a23cgroup.24 251-2. Why RDMA controller needed?26--------------------------------27 28Currently user space applications can easily take away all the rdma verb29specific resources such as AH, CQ, QP, MR etc. Due to which other applications30in other cgroup or kernel space ULPs may not even get chance to allocate any31rdma resources. This can lead to service unavailability.32 33Therefore RDMA controller is needed through which resource consumption34of processes can be limited. Through this controller different rdma35resources can be accounted.36 371-3. How is RDMA controller implemented?38----------------------------------------39 40RDMA cgroup allows limit configuration of resources. Rdma cgroup maintains41resource accounting per cgroup, per device using resource pool structure.42Each such resource pool is limited up to 64 resources in given resource pool43by rdma cgroup, which can be extended later if required.44 45This resource pool object is linked to the cgroup css. Typically there46are 0 to 4 resource pool instances per cgroup, per device in most use cases.47But nothing limits to have it more. At present hundreds of RDMA devices per48single cgroup may not be handled optimally, however there is no49known use case or requirement for such configuration either.50 51Since RDMA resources can be allocated from any process and can be freed by any52of the child processes which shares the address space, rdma resources are53always owned by the creator cgroup css. This allows process migration from one54to other cgroup without major complexity of transferring resource ownership;55because such ownership is not really present due to shared nature of56rdma resources. Linking resources around css also ensures that cgroups can be57deleted after processes migrated. This allow progress migration as well with58active resources, even though that is not a primary use case.59 60Whenever RDMA resource charging occurs, owner rdma cgroup is returned to61the caller. Same rdma cgroup should be passed while uncharging the resource.62This also allows process migrated with active RDMA resource to charge63to new owner cgroup for new resource. It also allows to uncharge resource of64a process from previously charged cgroup which is migrated to new cgroup,65even though that is not a primary use case.66 67Resource pool object is created in following situations.68(a) User sets the limit and no previous resource pool exist for the device69of interest for the cgroup.70(b) No resource limits were configured, but IB/RDMA stack tries to71charge the resource. So that it correctly uncharge them when applications are72running without limits and later on when limits are enforced during uncharging,73otherwise usage count will drop to negative.74 75Resource pool is destroyed if all the resource limits are set to max and76it is the last resource getting deallocated.77 78User should set all the limit to max value if it intents to remove/unconfigure79the resource pool for a particular device.80 81IB stack honors limits enforced by the rdma controller. When application82query about maximum resource limits of IB device, it returns minimum of83what is configured by user for a given cgroup and what is supported by84IB device.85 86Following resources can be accounted by rdma controller.87 88 ========== =============================89 hca_handle Maximum number of HCA Handles90 hca_object Maximum number of HCA Objects91 ========== =============================92 932. Usage Examples94=================95 96(a) Configure resource limit::97 98 echo mlx4_0 hca_handle=2 hca_object=2000 > /sys/fs/cgroup/rdma/1/rdma.max99 echo ocrdma1 hca_handle=3 > /sys/fs/cgroup/rdma/2/rdma.max100 101(b) Query resource limit::102 103 cat /sys/fs/cgroup/rdma/2/rdma.max104 #Output:105 mlx4_0 hca_handle=2 hca_object=2000106 ocrdma1 hca_handle=3 hca_object=max107 108(c) Query current usage::109 110 cat /sys/fs/cgroup/rdma/2/rdma.current111 #Output:112 mlx4_0 hca_handle=1 hca_object=20113 ocrdma1 hca_handle=1 hca_object=23114 115(d) Delete resource limit::116 117 echo mlx4_0 hca_handle=max hca_object=max > /sys/fs/cgroup/rdma/1/rdma.max118