net_prio.rst 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. =======================
  2. Network priority cgroup
  3. =======================
  4. The Network priority cgroup provides an interface to allow an administrator to
  5. dynamically set the priority of network traffic generated by various
  6. applications
  7. Nominally, an application would set the priority of its traffic via the
  8. SO_PRIORITY socket option. This however, is not always possible because:
  9. 1) The application may not have been coded to set this value
  10. 2) The priority of application traffic is often a site-specific administrative
  11. decision rather than an application defined one.
  12. This cgroup allows an administrator to assign a process to a group which defines
  13. the priority of egress traffic on a given interface. Network priority groups can
  14. be created by first mounting the cgroup filesystem::
  15. # mount -t cgroup -onet_prio none /sys/fs/cgroup/net_prio
  16. With the above step, the initial group acting as the parent accounting group
  17. becomes visible at '/sys/fs/cgroup/net_prio'. This group includes all tasks in
  18. the system. '/sys/fs/cgroup/net_prio/tasks' lists the tasks in this cgroup.
  19. Each net_prio cgroup contains two files that are subsystem specific
  20. net_prio.prioidx
  21. This file is read-only, and is simply informative. It contains a unique
  22. integer value that the kernel uses as an internal representation of this
  23. cgroup.
  24. net_prio.ifpriomap
  25. This file contains a map of the priorities assigned to traffic originating
  26. from processes in this group and egressing the system on various interfaces.
  27. It contains a list of tuples in the form <ifname priority>. Contents of this
  28. file can be modified by echoing a string into the file using the same tuple
  29. format. For example::
  30. echo "eth0 5" > /sys/fs/cgroups/net_prio/iscsi/net_prio.ifpriomap
  31. This command would force any traffic originating from processes belonging to the
  32. iscsi net_prio cgroup and egressing on interface eth0 to have the priority of
  33. said traffic set to the value 5. The parent accounting group also has a
  34. writeable 'net_prio.ifpriomap' file that can be used to set a system default
  35. priority.
  36. Priorities are set immediately prior to queueing a frame to the device
  37. queueing discipline (qdisc) so priorities will be assigned prior to the hardware
  38. queue selection being made.
  39. One usage for the net_prio cgroup is with mqprio qdisc allowing application
  40. traffic to be steered to hardware/driver based traffic classes. These mappings
  41. can then be managed by administrators or other networking protocols such as
  42. DCBX.
  43. A new net_prio cgroup inherits the parent's configuration.