Intel RDT特性详解介绍了RDT的基本概念,以及通过PQOS工具使用RDT。本文主要是介绍如何通过内核来使用RDT。

我的内核版本为4.14.32,内核对RDT的支持有版本要求,详情请参考OS interface feature support。cpu型号为Intel Xeon E5 2650 v4,共两个cpu。

内核编译

RDT技术的选项位于“processor type and feature” -> “Intel Resource Director Technology Allocation support”。

挂载文件系统

mount -t resctrl resctrl /sys/fs/resctrl

Resource alloc and monitor groups

Resource groups

  • CTRL_MON groups

Resource groups are represented as directories in the resctrl file system. The default group is the root directory which, immediately after mounting, owns all the tasks and cpus in the system and can make full use of all resources.
On a system with RDT control features additional directories can be created in the root directory that specify different amounts of each resource. The root and these additional top level directories are referred to as “CTRL_MON” groups.

  • MON groups

On a system with RDT monitoring the root directory and other top level directories contain a directory named “mon_groups” in which additional directories can be created to monitor subsets of tasks in the CTRL_MON group that is their ancestor. These are called “MON” groups.

All groups contain the following files

  • tasks
    Reading this file shows the list of all tasks that belong to this group. Writing a task id to the file will add a task to the group.
  • cpus
    是一个16进制整数,每一个bit代表一个CPU核心,比如我这里有10个“f”,意味着该机器有40个core。

When control is enabled

When control is enabled all CTRL_MON groups will also contain:

  • schemata
    策略表,每个策略一行,格式为:
    L3: cache_id0 = cbm; cache_id1 = cbm
    这里的cache id可以理解为CPU id,而后面的cbm是分配给cpu的L3单元数量。我这块CPU每个socket会有11个L3 cache 单元也就是7ff。就是指在cpu cache的每个组内,group可以使用的cache line的数量。

When monitoring is enabled

When monitoring is enabled all MON groups will also contain:

  • mon_data
    This contains a set of files organized by L3 domain and by RDT event. E.g. on a system with two L3 domains there will be subdirectories “mon_L3_00” and “mon_L3_01”. Each of these directories have one file per event (e.g. “llc_occupancy”, “mbm_total_bytes”, and “mbm_local_bytes”). In a MON group these files provide a read out of the current value of the event for all tasks in the group(在MON组中,这些文件为组中的所有任务提供读取当前事件的值).

Examples for RDT allocation usage

具体例子请参考intel_rdt_ui.txt

Examples for RDT Monitoring along with allocation usage

具体例子请参考intel_rdt_ui.txt


参考资料:

  1. intel_rdt_ui.txt
  2. Linux 4.10中CAT的使用