net_prio.txt 2.5 KB

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