€•×mŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ(/translations/zh_CN/accounting/taskstats”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/zh_TW/accounting/taskstats”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/it_IT/accounting/taskstats”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/ja_JP/accounting/taskstats”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/ko_KR/accounting/taskstats”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/sp_SP/accounting/taskstats”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒPer-task statistics interface”h]”hŒPer-task statistics interface”…””}”(hh¨hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hh£hžhhŸŒB/var/lib/git/docbuild/linux/Documentation/accounting/taskstats.rst”h KubhŒ paragraph”“”)”}”(hŒtTaskstats is a netlink-based interface for sending per-task and per-process statistics from the kernel to userspace.”h]”hŒtTaskstats is a netlink-based interface for sending per-task and per-process statistics from the kernel to userspace.”…””}”(hh¹hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Khh£hžhubh¸)”}”(hŒ2Taskstats was designed for the following benefits:”h]”hŒ2Taskstats was designed for the following benefits:”…””}”(hhÇhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K hh£hžhubhŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒHefficiently provide statistics during lifetime of a task and on its exit”h]”h¸)”}”(hhÞh]”hŒHefficiently provide statistics during lifetime of a task and on its exit”…””}”(hhàhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K hhÜubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhh×hžhhŸh¶h NubhÛ)”}”(hŒ4unified interface for multiple accounting subsystems”h]”h¸)”}”(hhõh]”hŒ4unified interface for multiple accounting subsystems”…””}”(hh÷hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K hhóubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhh×hžhhŸh¶h NubhÛ)”}”(hŒ3extensibility for use by future accounting patches ”h]”h¸)”}”(hŒ2extensibility for use by future accounting patches”h]”hŒ2extensibility for use by future accounting patches”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhh×hžhhŸh¶h Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1hÕhŸh¶h K hh£hžhubh¢)”}”(hhh]”(h§)”}”(hŒ Terminology”h]”hŒ Terminology”…””}”(hj-hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hj*hžhhŸh¶h Kubh¸)”}”(hŒ£"pid", "tid" and "task" are used interchangeably and refer to the standard Linux task defined by struct task_struct. per-pid stats are the same as per-task stats.”h]”hŒ¯â€œpidâ€, “tid†and “task†are used interchangeably and refer to the standard Linux task defined by struct task_struct. per-pid stats are the same as per-task stats.”…””}”(hj;hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Khj*hžhubh¸)”}”(hX7"tgid", "process" and "thread group" are used interchangeably and refer to the tasks that share an mm_struct i.e. the traditional Unix process. Despite the use of tgid, there is no special treatment for the task that is thread group leader - a process is deemed alive as long as it has any task belonging to it.”h]”hXC“tgidâ€, “process†and “thread group†are used interchangeably and refer to the tasks that share an mm_struct i.e. the traditional Unix process. Despite the use of tgid, there is no special treatment for the task that is thread group leader - a process is deemed alive as long as it has any task belonging to it.”…””}”(hjIhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Khj*hžhubeh}”(h]”Œ terminology”ah ]”h"]”Œ terminology”ah$]”h&]”uh1h¡hh£hžhhŸh¶h Kubh¢)”}”(hhh]”(h§)”}”(hŒUsage”h]”hŒUsage”…””}”(hjbhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hj_hžhhŸh¶h Kubh¸)”}”(hX,To get statistics during a task's lifetime, userspace opens a unicast netlink socket (NETLINK_GENERIC family) and sends commands specifying a pid or a tgid. The response contains statistics for a task (if pid is specified) or the sum of statistics for all tasks of the process (if tgid is specified).”h]”hX.To get statistics during a task’s lifetime, userspace opens a unicast netlink socket (NETLINK_GENERIC family) and sends commands specifying a pid or a tgid. The response contains statistics for a task (if pid is specified) or the sum of statistics for all tasks of the process (if tgid is specified).”…””}”(hjphžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Khj_hžhubh¸)”}”(hX“To obtain statistics for tasks which are exiting, the userspace listener sends a register command and specifies a cpumask. Whenever a task exits on one of the cpus in the cpumask, its per-pid statistics are sent to the registered listener. Using cpumasks allows the data received by one listener to be limited and assists in flow control over the netlink interface and is explained in more detail below.”h]”hX“To obtain statistics for tasks which are exiting, the userspace listener sends a register command and specifies a cpumask. Whenever a task exits on one of the cpus in the cpumask, its per-pid statistics are sent to the registered listener. Using cpumasks allows the data received by one listener to be limited and assists in flow control over the netlink interface and is explained in more detail below.”…””}”(hj~hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K#hj_hžhubh¸)”}”(hŒ÷If the exiting task is the last thread exiting its thread group, an additional record containing the per-tgid stats is also sent to userspace. The latter contains the sum of per-pid stats for all threads in the thread group, both past and present.”h]”hŒ÷If the exiting task is the last thread exiting its thread group, an additional record containing the per-tgid stats is also sent to userspace. The latter contains the sum of per-pid stats for all threads in the thread group, both past and present.”…””}”(hjŒhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K*hj_hžhubh¸)”}”(hX>getdelays.c is a simple utility demonstrating usage of the taskstats interface for reporting delay accounting statistics. Users can register cpumasks, send commands and process responses, listen for per-tid/tgid exit data, write the data received to a file and do basic flow control by increasing receive buffer sizes.”h]”hX>getdelays.c is a simple utility demonstrating usage of the taskstats interface for reporting delay accounting statistics. Users can register cpumasks, send commands and process responses, listen for per-tid/tgid exit data, write the data received to a file and do basic flow control by increasing receive buffer sizes.”…””}”(hjšhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K/hj_hžhubeh}”(h]”Œusage”ah ]”h"]”Œusage”ah$]”h&]”uh1h¡hh£hžhhŸh¶h Kubh¢)”}”(hhh]”(h§)”}”(hŒ Interface”h]”hŒ Interface”…””}”(hj³hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hj°hžhhŸh¶h K6ubh¸)”}”(hŒFThe user-kernel interface is encapsulated in include/linux/taskstats.h”h]”hŒFThe user-kernel interface is encapsulated in include/linux/taskstats.h”…””}”(hjÁhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K8hj°hžhubh¸)”}”(hŒ«To avoid this documentation becoming obsolete as the interface evolves, only an outline of the current version is given. taskstats.h always overrides the description here.”h]”hŒ«To avoid this documentation becoming obsolete as the interface evolves, only an outline of the current version is given. taskstats.h always overrides the description here.”…””}”(hjÏhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K:hj°hžhubh¸)”}”(hŒùstruct taskstats is the common accounting structure for both per-pid and per-tgid data. It is versioned and can be extended by each accounting subsystem that is added to the kernel. The fields and their semantics are defined in the taskstats.h file.”h]”hŒùstruct taskstats is the common accounting structure for both per-pid and per-tgid data. It is versioned and can be extended by each accounting subsystem that is added to the kernel. The fields and their semantics are defined in the taskstats.h file.”…””}”(hjÝhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K>hj°hžhubh¸)”}”(hŒºThe data exchanged between user and kernel space is a netlink message belonging to the NETLINK_GENERIC family and using the netlink attributes interface. The messages are in the format::”h]”hŒ¹The data exchanged between user and kernel space is a netlink message belonging to the NETLINK_GENERIC family and using the netlink attributes interface. The messages are in the format:”…””}”(hjëhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KChj°hžhubhŒ literal_block”“”)”}”(hŒž+----------+- - -+-------------+-------------------+ | nlmsghdr | Pad | genlmsghdr | taskstats payload | +----------+- - -+-------------+-------------------+”h]”hŒž+----------+- - -+-------------+-------------------+ | nlmsghdr | Pad | genlmsghdr | taskstats payload | +----------+- - -+-------------+-------------------+”…””}”hjûsbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1jùhŸh¶h KGhj°hžhubh¸)”}”(hŒ:The taskstats payload is one of the following three kinds:”h]”hŒ:The taskstats payload is one of the following three kinds:”…””}”(hj hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KLhj°hžhubh¸)”}”(hX 1. Commands: Sent from user to kernel. Commands to get data on a pid/tgid consist of one attribute, of type TASKSTATS_CMD_ATTR_PID/TGID, containing a u32 pid or tgid in the attribute payload. The pid/tgid denotes the task/process for which userspace wants statistics.”h]”hX 1. Commands: Sent from user to kernel. Commands to get data on a pid/tgid consist of one attribute, of type TASKSTATS_CMD_ATTR_PID/TGID, containing a u32 pid or tgid in the attribute payload. The pid/tgid denotes the task/process for which userspace wants statistics.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KNhj°hžhubh¸)”}”(hX?Commands to register/deregister interest in exit data from a set of cpus consist of one attribute, of type TASKSTATS_CMD_ATTR_REGISTER/DEREGISTER_CPUMASK and contain a cpumask in the attribute payload. The cpumask is specified as an ascii string of comma-separated cpu ranges e.g. to listen to exit data from cpus 1,2,3,5,7,8 the cpumask would be "1-3,5,7-8". If userspace forgets to deregister interest in cpus before closing the listening socket, the kernel cleans up its interest set over time. However, for the sake of efficiency, an explicit deregistration is advisable.”h]”hXCCommands to register/deregister interest in exit data from a set of cpus consist of one attribute, of type TASKSTATS_CMD_ATTR_REGISTER/DEREGISTER_CPUMASK and contain a cpumask in the attribute payload. The cpumask is specified as an ascii string of comma-separated cpu ranges e.g. to listen to exit data from cpus 1,2,3,5,7,8 the cpumask would be “1-3,5,7-8â€. If userspace forgets to deregister interest in cpus before closing the listening socket, the kernel cleans up its interest set over time. However, for the sake of efficiency, an explicit deregistration is advisable.”…””}”(hj'hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KShj°hžhubh¸)”}”(hŒˆ2. Response for a command: sent from the kernel in response to a userspace command. The payload is a series of three attributes of type:”h]”hŒˆ2. Response for a command: sent from the kernel in response to a userspace command. The payload is a series of three attributes of type:”…””}”(hj5hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K]hj°hžhubh¸)”}”(hŒza) TASKSTATS_TYPE_AGGR_PID/TGID : attribute containing no payload but indicates a pid/tgid will be followed by some stats.”h]”hŒza) TASKSTATS_TYPE_AGGR_PID/TGID : attribute containing no payload but indicates a pid/tgid will be followed by some stats.”…””}”(hjChžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K`hj°hžhubh¸)”}”(hŒcb) TASKSTATS_TYPE_PID/TGID: attribute whose payload is the pid/tgid whose stats are being returned.”h]”hŒcb) TASKSTATS_TYPE_PID/TGID: attribute whose payload is the pid/tgid whose stats are being returned.”…””}”(hjQhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kchj°hžhubh¸)”}”(hŒ†c) TASKSTATS_TYPE_STATS: attribute with a struct taskstats as payload. The same structure is used for both per-pid and per-tgid stats.”h]”hŒ†c) TASKSTATS_TYPE_STATS: attribute with a struct taskstats as payload. The same structure is used for both per-pid and per-tgid stats.”…””}”(hj_hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kfhj°hžhubhŒenumerated_list”“”)”}”(hhh]”hÛ)”}”(hŒxNew message sent by kernel whenever a task exits. The payload consists of a series of attributes of the following type: ”h]”h¸)”}”(hŒwNew message sent by kernel whenever a task exits. The payload consists of a series of attributes of the following type:”h]”hŒwNew message sent by kernel whenever a task exits. The payload consists of a series of attributes of the following type:”…””}”(hjvhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kihjrubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhjohžhhŸh¶h Nubah}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ.”Œstart”Kuh1jmhj°hžhhŸh¶h Kiubjn)”}”(hhh]”(hÛ)”}”(hŒHTASKSTATS_TYPE_AGGR_PID: indicates next two attributes will be pid+stats”h]”h¸)”}”(hj›h]”hŒHTASKSTATS_TYPE_AGGR_PID: indicates next two attributes will be pid+stats”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Klhj™ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhj–hžhhŸh¶h NubhÛ)”}”(hŒ/TASKSTATS_TYPE_PID: contains exiting task's pid”h]”h¸)”}”(hj²h]”hŒ1TASKSTATS_TYPE_PID: contains exiting task’s pid”…””}”(hj´hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kmhj°ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhj–hžhhŸh¶h NubhÛ)”}”(hŒ?TASKSTATS_TYPE_STATS: contains the exiting task's per-pid stats”h]”h¸)”}”(hjÉh]”hŒATASKSTATS_TYPE_STATS: contains the exiting task’s per-pid stats”…””}”(hjËhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KnhjÇubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhj–hžhhŸh¶h NubhÛ)”}”(hŒJTASKSTATS_TYPE_AGGR_TGID: indicates next two attributes will be tgid+stats”h]”h¸)”}”(hjàh]”hŒJTASKSTATS_TYPE_AGGR_TGID: indicates next two attributes will be tgid+stats”…””}”(hjâhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KohjÞubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhj–hžhhŸh¶h NubhÛ)”}”(hŒCTASKSTATS_TYPE_TGID: contains tgid of process to which task belongs”h]”h¸)”}”(hj÷h]”hŒCTASKSTATS_TYPE_TGID: contains tgid of process to which task belongs”…””}”(hjùhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kphjõubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhj–hžhhŸh¶h NubhÛ)”}”(hŒNTASKSTATS_TYPE_STATS: contains the per-tgid stats for exiting task's process ”h]”h¸)”}”(hŒLTASKSTATS_TYPE_STATS: contains the per-tgid stats for exiting task's process”h]”hŒNTASKSTATS_TYPE_STATS: contains the per-tgid stats for exiting task’s process”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kqhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhj–hžhhŸh¶h Nubeh}”(h]”h ]”h"]”h$]”h&]”jŒ loweralpha”j’hj“Œ)”uh1jmhj°hžhhŸh¶h Klubeh}”(h]”Œ interface”ah ]”h"]”Œ interface”ah$]”h&]”uh1h¡hh£hžhhŸh¶h K6ubh¢)”}”(hhh]”(h§)”}”(hŒper-tgid stats”h]”hŒper-tgid stats”…””}”(hj7hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hj4hžhhŸh¶h Kuubh¸)”}”(hŒùTaskstats provides per-process stats, in addition to per-task stats, since resource management is often done at a process granularity and aggregating task stats in userspace alone is inefficient and potentially inaccurate (due to lack of atomicity).”h]”hŒùTaskstats provides per-process stats, in addition to per-task stats, since resource management is often done at a process granularity and aggregating task stats in userspace alone is inefficient and potentially inaccurate (due to lack of atomicity).”…””}”(hjEhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kwhj4hžhubh¸)”}”(hXiHowever, maintaining per-process, in addition to per-task stats, within the kernel has space and time overheads. To address this, the taskstats code accumulates each exiting task's statistics into a process-wide data structure. When the last task of a process exits, the process level data accumulated also gets sent to userspace (along with the per-task data).”h]”hXkHowever, maintaining per-process, in addition to per-task stats, within the kernel has space and time overheads. To address this, the taskstats code accumulates each exiting task’s statistics into a process-wide data structure. When the last task of a process exits, the process level data accumulated also gets sent to userspace (along with the per-task data).”…””}”(hjShžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K|hj4hžhubh¸)”}”(hŒ¿When a user queries to get per-tgid data, the sum of all other live threads in the group is added up and added to the accumulated total for previously exited threads of the same thread group.”h]”hŒ¿When a user queries to get per-tgid data, the sum of all other live threads in the group is added up and added to the accumulated total for previously exited threads of the same thread group.”…””}”(hjahžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K‚hj4hžhubeh}”(h]”Œper-tgid-stats”ah ]”h"]”Œper-tgid stats”ah$]”h&]”uh1h¡hh£hžhhŸh¶h Kuubh¢)”}”(hhh]”(h§)”}”(hŒExtending taskstats”h]”hŒExtending taskstats”…””}”(hjzhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hjwhžhhŸh¶h K‡ubh¸)”}”(hŒ˜There are two ways to extend the taskstats interface to export more per-task/process stats as patches to collect them get added to the kernel in future:”h]”hŒ˜There are two ways to extend the taskstats interface to export more per-task/process stats as patches to collect them get added to the kernel in future:”…””}”(hjˆhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K‰hjwhžhubjn)”}”(hhh]”(hÛ)”}”(hŒéAdding more fields to the end of the existing struct taskstats. Backward compatibility is ensured by the version number within the structure. Userspace will use only the fields of the struct that correspond to the version its using. ”h]”h¸)”}”(hŒèAdding more fields to the end of the existing struct taskstats. Backward compatibility is ensured by the version number within the structure. Userspace will use only the fields of the struct that correspond to the version its using.”h]”hŒèAdding more fields to the end of the existing struct taskstats. Backward compatibility is ensured by the version number within the structure. Userspace will use only the fields of the struct that correspond to the version its using.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Khj™ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhj–hžhhŸh¶h NubhÛ)”}”(hXDefining separate statistic structs and using the netlink attributes interface to return them. Since userspace processes each netlink attribute independently, it can always ignore attributes whose type it does not understand (because it is using an older version of the interface). ”h]”h¸)”}”(hXDefining separate statistic structs and using the netlink attributes interface to return them. Since userspace processes each netlink attribute independently, it can always ignore attributes whose type it does not understand (because it is using an older version of the interface).”h]”hXDefining separate statistic structs and using the netlink attributes interface to return them. Since userspace processes each netlink attribute independently, it can always ignore attributes whose type it does not understand (because it is using an older version of the interface).”…””}”(hjµhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K’hj±ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhj–hžhhŸh¶h Nubeh}”(h]”h ]”h"]”h$]”h&]”jj‘j’hj“j”uh1jmhjwhžhhŸh¶h Kubh¸)”}”(hXñChoosing between 1. and 2. is a matter of trading off flexibility and overhead. If only a few fields need to be added, then 1. is the preferable path since the kernel and userspace don't need to incur the overhead of processing new netlink attributes. But if the new fields expand the existing struct too much, requiring disparate userspace accounting utilities to unnecessarily receive large structures whose fields are of no interest, then extending the attributes structure would be worthwhile.”h]”hXóChoosing between 1. and 2. is a matter of trading off flexibility and overhead. If only a few fields need to be added, then 1. is the preferable path since the kernel and userspace don’t need to incur the overhead of processing new netlink attributes. But if the new fields expand the existing struct too much, requiring disparate userspace accounting utilities to unnecessarily receive large structures whose fields are of no interest, then extending the attributes structure would be worthwhile.”…””}”(hjÏhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K˜hjwhžhubeh}”(h]”Œextending-taskstats”ah ]”h"]”Œextending taskstats”ah$]”h&]”uh1h¡hh£hžhhŸh¶h K‡ubh¢)”}”(hhh]”(h§)”}”(hŒFlow control for taskstats”h]”hŒFlow control for taskstats”…””}”(hjèhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hjåhžhhŸh¶h K¡ubh¸)”}”(hXWhen the rate of task exits becomes large, a listener may not be able to keep up with the kernel's rate of sending per-tid/tgid exit data leading to data loss. This possibility gets compounded when the taskstats structure gets extended and the number of cpus grows large.”h]”hXWhen the rate of task exits becomes large, a listener may not be able to keep up with the kernel’s rate of sending per-tid/tgid exit data leading to data loss. This possibility gets compounded when the taskstats structure gets extended and the number of cpus grows large.”…””}”(hjöhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K£hjåhžhubh¸)”}”(hŒMTo avoid losing statistics, userspace should do one or more of the following:”h]”hŒMTo avoid losing statistics, userspace should do one or more of the following:”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K¨hjåhžhubhÖ)”}”(hhh]”(hÛ)”}”(hŒdincrease the receive buffer sizes for the netlink sockets opened by listeners to receive exit data. ”h]”h¸)”}”(hŒcincrease the receive buffer sizes for the netlink sockets opened by listeners to receive exit data.”h]”hŒcincrease the receive buffer sizes for the netlink sockets opened by listeners to receive exit data.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kªhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhjhžhhŸh¶h NubhÛ)”}”(hX5create more listeners and reduce the number of cpus being listened to by each listener. In the extreme case, there could be one listener for each cpu. Users may also consider setting the cpu affinity of the listener to the subset of cpus to which it listens, especially if they are listening to just one cpu. ”h]”h¸)”}”(hX4create more listeners and reduce the number of cpus being listened to by each listener. In the extreme case, there could be one listener for each cpu. Users may also consider setting the cpu affinity of the listener to the subset of cpus to which it listens, especially if they are listening to just one cpu.”h]”hX4create more listeners and reduce the number of cpus being listened to by each listener. In the extreme case, there could be one listener for each cpu. Users may also consider setting the cpu affinity of the listener to the subset of cpus to which it listens, especially if they are listening to just one cpu.”…””}”(hj1hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K­hj-ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÚhjhžhhŸh¶h Nubeh}”(h]”h ]”h"]”h$]”h&]”j(j)uh1hÕhŸh¶h Kªhjåhžhubh¸)”}”(hŒ£Despite these measures, if the userspace receives ENOBUFS error messages indicated overflow of receive buffers, it should take measures to handle the loss of data.”h]”hŒ£Despite these measures, if the userspace receives ENOBUFS error messages indicated overflow of receive buffers, it should take measures to handle the loss of data.”…””}”(hjKhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K²hjåhžhubeh}”(h]”Œflow-control-for-taskstats”ah ]”h"]”Œflow control for taskstats”ah$]”h&]”uh1h¡hh£hžhhŸh¶h K¡ubeh}”(h]”Œper-task-statistics-interface”ah ]”h"]”Œper-task statistics interface”ah$]”h&]”uh1h¡hhhžhhŸh¶h Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”h¶uh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(h¦NŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jŒŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”h¶Œ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jfjcj\jYj­jªj1j.jtjqjâjßj^j[uŒ nametypes”}”(jf‰j\‰j­‰j1‰jt‰jâ‰j^‰uh}”(jch£jYj*jªj_j.j°jqj4jßjwj[jåuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”hŒsystem_message”“”)”}”(hhh]”h¸)”}”(hŒ:Enumerated list start value not ordinal-1: "3" (ordinal 3)”h]”hŒ>Enumerated list start value not ordinal-1: “3†(ordinal 3)”…””}”(hjóhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hjðubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”h¶Œline”Kuh1jîhj°hžhhŸh¶h KiubaŒtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nhžhub.