rdma.rst 4.4 KB

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