1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */ 2607ca46eSDavid Howells /* cgroupstats.h - exporting per-cgroup statistics 3607ca46eSDavid Howells * 4607ca46eSDavid Howells * Copyright IBM Corporation, 2007 5607ca46eSDavid Howells * Author Balbir Singh <balbir@linux.vnet.ibm.com> 6607ca46eSDavid Howells * 7607ca46eSDavid Howells * This program is free software; you can redistribute it and/or modify it 8607ca46eSDavid Howells * under the terms of version 2.1 of the GNU Lesser General Public License 9607ca46eSDavid Howells * as published by the Free Software Foundation. 10607ca46eSDavid Howells * 11607ca46eSDavid Howells * This program is distributed in the hope that it would be useful, but 12607ca46eSDavid Howells * WITHOUT ANY WARRANTY; without even the implied warranty of 13607ca46eSDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14607ca46eSDavid Howells */ 15607ca46eSDavid Howells 16607ca46eSDavid Howells #ifndef _LINUX_CGROUPSTATS_H 17607ca46eSDavid Howells #define _LINUX_CGROUPSTATS_H 18607ca46eSDavid Howells 19607ca46eSDavid Howells #include <linux/types.h> 20607ca46eSDavid Howells #include <linux/taskstats.h> 21607ca46eSDavid Howells 22607ca46eSDavid Howells /* 23607ca46eSDavid Howells * Data shared between user space and kernel space on a per cgroup 24607ca46eSDavid Howells * basis. This data is shared using taskstats. 25607ca46eSDavid Howells * 26607ca46eSDavid Howells * Most of these states are derived by looking at the task->state value 27607ca46eSDavid Howells * 28607ca46eSDavid Howells * Each member is aligned to a 8 byte boundary. 29607ca46eSDavid Howells */ 30607ca46eSDavid Howells struct cgroupstats { 31607ca46eSDavid Howells __u64 nr_sleeping; /* Number of tasks sleeping */ 32607ca46eSDavid Howells __u64 nr_running; /* Number of tasks running */ 33607ca46eSDavid Howells __u64 nr_stopped; /* Number of tasks in stopped state */ 34607ca46eSDavid Howells __u64 nr_uninterruptible; /* Number of tasks in uninterruptible */ 35607ca46eSDavid Howells /* state */ 36607ca46eSDavid Howells __u64 nr_io_wait; /* Number of tasks waiting on IO */ 37607ca46eSDavid Howells }; 38607ca46eSDavid Howells 39607ca46eSDavid Howells /* 40607ca46eSDavid Howells * Commands sent from userspace 41607ca46eSDavid Howells * Not versioned. New commands should only be inserted at the enum's end 42607ca46eSDavid Howells * prior to __CGROUPSTATS_CMD_MAX 43607ca46eSDavid Howells */ 44607ca46eSDavid Howells 45607ca46eSDavid Howells enum { 46607ca46eSDavid Howells CGROUPSTATS_CMD_UNSPEC = __TASKSTATS_CMD_MAX, /* Reserved */ 47607ca46eSDavid Howells CGROUPSTATS_CMD_GET, /* user->kernel request/get-response */ 48607ca46eSDavid Howells CGROUPSTATS_CMD_NEW, /* kernel->user event */ 49607ca46eSDavid Howells __CGROUPSTATS_CMD_MAX, 50607ca46eSDavid Howells }; 51607ca46eSDavid Howells 52607ca46eSDavid Howells #define CGROUPSTATS_CMD_MAX (__CGROUPSTATS_CMD_MAX - 1) 53607ca46eSDavid Howells 54607ca46eSDavid Howells enum { 55607ca46eSDavid Howells CGROUPSTATS_TYPE_UNSPEC = 0, /* Reserved */ 56607ca46eSDavid Howells CGROUPSTATS_TYPE_CGROUP_STATS, /* contains name + stats */ 57607ca46eSDavid Howells __CGROUPSTATS_TYPE_MAX, 58607ca46eSDavid Howells }; 59607ca46eSDavid Howells 60607ca46eSDavid Howells #define CGROUPSTATS_TYPE_MAX (__CGROUPSTATS_TYPE_MAX - 1) 61607ca46eSDavid Howells 62607ca46eSDavid Howells enum { 63607ca46eSDavid Howells CGROUPSTATS_CMD_ATTR_UNSPEC = 0, 64607ca46eSDavid Howells CGROUPSTATS_CMD_ATTR_FD, 65607ca46eSDavid Howells __CGROUPSTATS_CMD_ATTR_MAX, 66607ca46eSDavid Howells }; 67607ca46eSDavid Howells 68607ca46eSDavid Howells #define CGROUPSTATS_CMD_ATTR_MAX (__CGROUPSTATS_CMD_ATTR_MAX - 1) 69607ca46eSDavid Howells 70607ca46eSDavid Howells #endif /* _LINUX_CGROUPSTATS_H */ 71