rdma.txt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. RDMA Controller
  2. ----------------
  3. Contents
  4. --------
  5. 1. Overview
  6. 1-1. What is RDMA controller?
  7. 1-2. Why RDMA controller needed?
  8. 1-3. How is RDMA controller implemented?
  9. 2. Usage Examples
  10. 1. Overview
  11. 1-1. What is RDMA controller?
  12. -----------------------------
  13. RDMA controller allows user to limit RDMA/IB specific resources that a given
  14. set of processes can use. These processes are grouped using RDMA controller.
  15. RDMA controller defines two resources which can be limited for processes of a
  16. cgroup.
  17. 1-2. Why RDMA controller needed?
  18. --------------------------------
  19. Currently user space applications can easily take away all the rdma verb
  20. specific resources such as AH, CQ, QP, MR etc. Due to which other applications
  21. in other cgroup or kernel space ULPs may not even get chance to allocate any
  22. rdma resources. This can leads to service unavailability.
  23. Therefore RDMA controller is needed through which resource consumption
  24. of processes can be limited. Through this controller different rdma
  25. resources can be accounted.
  26. 1-3. How is RDMA controller implemented?
  27. ----------------------------------------
  28. RDMA cgroup allows limit configuration of resources. Rdma cgroup maintains
  29. resource accounting per cgroup, per device using resource pool structure.
  30. Each such resource pool is limited up to 64 resources in given resource pool
  31. by rdma cgroup, which can be extended later if required.
  32. This resource pool object is linked to the cgroup css. Typically there
  33. are 0 to 4 resource pool instances per cgroup, per device in most use cases.
  34. But nothing limits to have it more. At present hundreds of RDMA devices per
  35. single cgroup may not be handled optimally, however there is no
  36. known use case or requirement for such configuration either.
  37. Since RDMA resources can be allocated from any process and can be freed by any
  38. of the child processes which shares the address space, rdma resources are
  39. always owned by the creator cgroup css. This allows process migration from one
  40. to other cgroup without major complexity of transferring resource ownership;
  41. because such ownership is not really present due to shared nature of
  42. rdma resources. Linking resources around css also ensures that cgroups can be
  43. deleted after processes migrated. This allow progress migration as well with
  44. active resources, even though that is not a primary use case.
  45. Whenever RDMA resource charging occurs, owner rdma cgroup is returned to
  46. the caller. Same rdma cgroup should be passed while uncharging the resource.
  47. This also allows process migrated with active RDMA resource to charge
  48. to new owner cgroup for new resource. It also allows to uncharge resource of
  49. a process from previously charged cgroup which is migrated to new cgroup,
  50. even though that is not a primary use case.
  51. Resource pool object is created in following situations.
  52. (a) User sets the limit and no previous resource pool exist for the device
  53. of interest for the cgroup.
  54. (b) No resource limits were configured, but IB/RDMA stack tries to
  55. charge the resource. So that it correctly uncharge them when applications are
  56. running without limits and later on when limits are enforced during uncharging,
  57. otherwise usage count will drop to negative.
  58. Resource pool is destroyed if all the resource limits are set to max and
  59. it is the last resource getting deallocated.
  60. User should set all the limit to max value if it intents to remove/unconfigure
  61. the resource pool for a particular device.
  62. IB stack honors limits enforced by the rdma controller. When application
  63. query about maximum resource limits of IB device, it returns minimum of
  64. what is configured by user for a given cgroup and what is supported by
  65. IB device.
  66. Following resources can be accounted by rdma controller.
  67. hca_handle Maximum number of HCA Handles
  68. hca_object Maximum number of HCA Objects
  69. 2. Usage Examples
  70. -----------------
  71. (a) Configure resource limit:
  72. echo mlx4_0 hca_handle=2 hca_object=2000 > /sys/fs/cgroup/rdma/1/rdma.max
  73. echo ocrdma1 hca_handle=3 > /sys/fs/cgroup/rdma/2/rdma.max
  74. (b) Query resource limit:
  75. cat /sys/fs/cgroup/rdma/2/rdma.max
  76. #Output:
  77. mlx4_0 hca_handle=2 hca_object=2000
  78. ocrdma1 hca_handle=3 hca_object=max
  79. (c) Query current usage:
  80. cat /sys/fs/cgroup/rdma/2/rdma.current
  81. #Output:
  82. mlx4_0 hca_handle=1 hca_object=20
  83. ocrdma1 hca_handle=1 hca_object=23
  84. (d) Delete resource limit:
  85. echo echo mlx4_0 hca_handle=max hca_object=max > /sys/fs/cgroup/rdma/1/rdma.max