Skip to content

cgroup private data and DRM/i915 integration

Matt Roper cgroups dri-devel intel-gfx 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest8 patches 11 repliesIn review
  2. v36 patches 16 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8cgroup: Allow registration and lookup of cgroup private data (v2)include/linux/cgroup-defs.h include/linux/cgroup.h kernel/cgroup/cgroup.c+197 -30 replies
2/8cgroup: Introduce task_get_dfl_cgroup() (v2)include/linux/cgroup.h+29 -00 replies
3/8cgroup: Introduce cgroup_priv_get_currentinclude/linux/cgroup.h kernel/cgroup/cgroup.c+24 -00 replies
4/8drm/i915: Adjust internal priority definitionsdrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem_context.c drivers/gpu/drm/i915/i915_request.h +1 more+13 -70 replies
5/8drm/i915: cgroup integration (v3)drivers/gpu/drm/i915/Makefile drivers/gpu/drm/i915/i915_cgroup.c drivers/gpu/drm/i915/i915_drv.c +2 more+185 -00 replies
6/8drm/i915: Introduce 'priority offset' for GPU contexts (v3)drivers/gpu/drm/i915/i915_cgroup.c drivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem_context.c +3 more+76 -120 replies
7/8drm/i915: Introduce per-cgroup display boost settingdrivers/gpu/drm/i915/i915_cgroup.c drivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_request.h +2 more+28 -20 replies
8/8drm/i915: Add context priority & priority offset to debugfs (v2)drivers/gpu/drm/i915/i915_debugfs.c+3 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/8] cgroup private data and DRM/i915 integration

This is the fourth iteration of the work previously posted here:
(v1) https://lists.freedesktop.org/archives/intel-gfx/2018-January/153156.html
(v2) https://www.mail-archive.com/[email protected]/msg208170.html
(v3) https://lists.freedesktop.org/archives/intel-gfx/2018-March/157928.html

The high level goal of this work is to allow non-cgroup-controller parts of the kernel (e.g., device drivers) to register their own private policy data for specific cgroups. That mechanism is then made use of in the i915 graphics driver to allow GPU priority to be assigned according to the cgroup membership of the owning process. Please see the v1 cover letter linked above for a more in-depth explanation and justification.

v4 of this series brings large changes to the cgroup core half of the series and moderate changes to the i915 side.

cgroup core changes:

* The cgroup private data interface and implementation has changed again. The internal implementation is ida+radixtree based to allow much faster lookups than the previous hashtable approach. Private data is now registered and looked up via kref, which should allow the same private data to be set on multiple cgroups at the same time. The interface now looks like:

- cgroup_priv_getkey()
Obtain an integer key that will be used to store/lookup cgroup private data. This only needs to be called once at startup, driver init, etc.; after that the same key is used to store private data against any cgroup

- cgroup_priv_destroykey(key)
Release a private data key and drop references to any private data associated with the key on all cgroups. This function is very heavy, but will generally only be called by module-based users of the interface when the module is unloaded.

- cgroup_priv_install(cgrp, key, ref)
Store private data for a cgroup under the given key and increment the reference count.

- cgroup_priv_get(cgrp, key)
Take and return a reference to a cgroup's private data associated with the given key.

- cgroup_priv_get_current(key)
Same as cgroup_priv_get, but operates on the current task's cgroup.

- cgroup_priv_release(cgrp, key)
Remove private data from a cgroup and decrement its reference count.

* Dropped the cgroup_permission() function. My i915 usage of this functionality will take a different approach for determining access control.

i915 cgroup-based priority changes:

* cgroup priority offset is now bounded such that (context+cgroup) adjustments fall within the range [-0x7fffff,0x7fffff]. This only takes 24 bits, leaving several effective priority bits for future flags or bookkeeping.

* Display boost is added as a second cgroup parameter; each cgroup's processes can get differing boosts if a display operation is waiting on their completion. If we have non-overlapping cgroup priority ranges, this allows a system administrator to decide whether workloads from the lower priority cgroup(s) should still jump past the workloads in some/all of the higher priority cgroups.

* Access control for cgroup settings has been changed. Instead of following cgroup filesystem permissions, we now restrict the access to either the DRM master or capable(CAP_SYS_RESOURCE).

Cc Tejun Heo <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Roman Gushchin <[email protected]>
Cc Chris Wilson <[email protected]>

Matt Roper (8):
cgroup: Allow registration and lookup of cgroup private data (v2)
cgroup: Introduce task_get_dfl_cgroup() (v2)
cgroup: Introduce cgroup_priv_get_current
drm/i915: Adjust internal priority definitions drm/i915: cgroup integration (v3)
drm/i915: Introduce 'priority offset' for GPU contexts (v3) drm/i915: Introduce per-cgroup display boost setting drm/i915: Add context priority & priority offset to debugfs (v2)

 drivers/gpu/drm/i915/Makefile           |   1 +
 drivers/gpu/drm/i915/i915_cgroup.c      | 205 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_debugfs.c     |   3 +
 drivers/gpu/drm/i915/i915_drv.c         |   7 ++
 drivers/gpu/drm/i915/i915_drv.h         |  33 ++++-
 drivers/gpu/drm/i915/i915_gem_context.c |  11 +-
 drivers/gpu/drm/i915/i915_gem_context.h |   9 ++
 drivers/gpu/drm/i915/i915_request.h     |  18 ++-
 drivers/gpu/drm/i915/intel_display.c    |   5 +-
 include/linux/cgroup-defs.h             |   8 ++
 include/linux/cgroup.h                  |  37 ++++++
 include/uapi/drm/i915_drm.h             |  14 +++
 kernel/cgroup/cgroup.c                  | 208 +++++++++++++++++++++++++++++++-
 13 files changed, 545 insertions(+), 14 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_cgroup.c
Signature · 6 lines
2.14.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel