Skip to content

Instantly share code, notes, and snippets.

@brendangregg
Created January 19, 2016 20:48
Show Gist options
  • Save brendangregg/4784243a6b3357939ae5 to your computer and use it in GitHub Desktop.
Save brendangregg/4784243a6b3357939ae5 to your computer and use it in GitHub Desktop.
pahole of task_struct, linux 4.4
struct task_struct {
volatile long int state; /* 0 8 */
void * stack; /* 8 8 */
atomic_t usage; /* 16 4 */
unsigned int flags; /* 20 4 */
unsigned int ptrace; /* 24 4 */
/* XXX 4 bytes hole, try to pack */
struct llist_node wake_entry; /* 32 8 */
int on_cpu; /* 40 4 */
unsigned int wakee_flips; /* 44 4 */
long unsigned int wakee_flip_decay_ts; /* 48 8 */
struct task_struct * last_wakee; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
int wake_cpu; /* 64 4 */
int on_rq; /* 68 4 */
int prio; /* 72 4 */
int static_prio; /* 76 4 */
int normal_prio; /* 80 4 */
unsigned int rt_priority; /* 84 4 */
const struct sched_class * sched_class; /* 88 8 */
struct sched_entity se; /* 96 392 */
/* --- cacheline 7 boundary (448 bytes) was 40 bytes ago --- */
struct sched_rt_entity rt; /* 488 48 */
/* --- cacheline 8 boundary (512 bytes) was 24 bytes ago --- */
struct task_group * sched_task_group; /* 536 8 */
struct sched_dl_entity dl; /* 544 192 */
/* --- cacheline 11 boundary (704 bytes) was 32 bytes ago --- */
struct hlist_head preempt_notifiers; /* 736 8 */
unsigned int btrace_seq; /* 744 4 */
unsigned int policy; /* 748 4 */
int nr_cpus_allowed; /* 752 4 */
/* XXX 4 bytes hole, try to pack */
cpumask_t cpus_allowed; /* 760 32 */
/* --- cacheline 12 boundary (768 bytes) was 24 bytes ago --- */
struct sched_info sched_info; /* 792 32 */
struct list_head tasks; /* 824 16 */
/* --- cacheline 13 boundary (832 bytes) was 8 bytes ago --- */
struct plist_node pushable_tasks; /* 840 40 */
struct rb_node pushable_dl_tasks; /* 880 24 */
/* --- cacheline 14 boundary (896 bytes) was 8 bytes ago --- */
struct mm_struct * mm; /* 904 8 */
struct mm_struct * active_mm; /* 912 8 */
u32 vmacache_seqnum; /* 920 4 */
/* XXX 4 bytes hole, try to pack */
struct vm_area_struct * vmacache[4]; /* 928 32 */
/* --- cacheline 15 boundary (960 bytes) --- */
struct task_rss_stat rss_stat; /* 960 16 */
int exit_state; /* 976 4 */
int exit_code; /* 980 4 */
int exit_signal; /* 984 4 */
int pdeath_signal; /* 988 4 */
long unsigned int jobctl; /* 992 8 */
unsigned int personality; /* 1000 4 */
unsigned int sched_reset_on_fork:1; /* 1004:31 4 */
unsigned int sched_contributes_to_load:1; /* 1004:30 4 */
unsigned int sched_migrated:1; /* 1004:29 4 */
/* XXX 29 bits hole, try to pack */
unsigned int in_execve:1; /* 1008:31 4 */
unsigned int in_iowait:1; /* 1008:30 4 */
unsigned int memcg_may_oom:1; /* 1008:29 4 */
unsigned int memcg_kmem_skip_account:1; /* 1008:28 4 */
/* XXX 28 bits hole, try to pack */
/* XXX 4 bytes hole, try to pack */
long unsigned int atomic_flags; /* 1016 8 */
/* --- cacheline 16 boundary (1024 bytes) --- */
struct restart_block restart_block; /* 1024 48 */
pid_t pid; /* 1072 4 */
pid_t tgid; /* 1076 4 */
struct task_struct * real_parent; /* 1080 8 */
/* --- cacheline 17 boundary (1088 bytes) --- */
struct task_struct * parent; /* 1088 8 */
struct list_head children; /* 1096 16 */
struct list_head sibling; /* 1112 16 */
struct task_struct * group_leader; /* 1128 8 */
struct list_head ptraced; /* 1136 16 */
/* --- cacheline 18 boundary (1152 bytes) --- */
struct list_head ptrace_entry; /* 1152 16 */
struct pid_link pids[3]; /* 1168 72 */
/* --- cacheline 19 boundary (1216 bytes) was 24 bytes ago --- */
struct list_head thread_group; /* 1240 16 */
struct list_head thread_node; /* 1256 16 */
struct completion * vfork_done; /* 1272 8 */
/* --- cacheline 20 boundary (1280 bytes) --- */
int * set_child_tid; /* 1280 8 */
int * clear_child_tid; /* 1288 8 */
cputime_t utime; /* 1296 8 */
cputime_t stime; /* 1304 8 */
cputime_t utimescaled; /* 1312 8 */
cputime_t stimescaled; /* 1320 8 */
cputime_t gtime; /* 1328 8 */
struct prev_cputime prev_cputime; /* 1336 24 */
/* --- cacheline 21 boundary (1344 bytes) was 16 bytes ago --- */
seqlock_t vtime_seqlock; /* 1360 8 */
long long unsigned int vtime_snap; /* 1368 8 */
enum {
VTIME_SLEEPING = 0,
VTIME_USER = 1,
VTIME_SYS = 2,
} vtime_snap_whence; /* 1376 4 */
/* XXX 4 bytes hole, try to pack */
long unsigned int nvcsw; /* 1384 8 */
long unsigned int nivcsw; /* 1392 8 */
u64 start_time; /* 1400 8 */
/* --- cacheline 22 boundary (1408 bytes) --- */
u64 real_start_time; /* 1408 8 */
long unsigned int min_flt; /* 1416 8 */
long unsigned int maj_flt; /* 1424 8 */
struct task_cputime cputime_expires; /* 1432 24 */
struct list_head cpu_timers[3]; /* 1456 48 */
/* --- cacheline 23 boundary (1472 bytes) was 32 bytes ago --- */
const struct cred * real_cred; /* 1504 8 */
const struct cred * cred; /* 1512 8 */
char comm[16]; /* 1520 16 */
/* --- cacheline 24 boundary (1536 bytes) --- */
struct nameidata * nameidata; /* 1536 8 */
struct sysv_sem sysvsem; /* 1544 8 */
struct sysv_shm sysvshm; /* 1552 16 */
long unsigned int last_switch_count; /* 1568 8 */
struct fs_struct * fs; /* 1576 8 */
struct files_struct * files; /* 1584 8 */
struct nsproxy * nsproxy; /* 1592 8 */
/* --- cacheline 25 boundary (1600 bytes) --- */
struct signal_struct * signal; /* 1600 8 */
struct sighand_struct * sighand; /* 1608 8 */
sigset_t blocked; /* 1616 8 */
sigset_t real_blocked; /* 1624 8 */
sigset_t saved_sigmask; /* 1632 8 */
struct sigpending pending; /* 1640 24 */
/* --- cacheline 26 boundary (1664 bytes) --- */
long unsigned int sas_ss_sp; /* 1664 8 */
size_t sas_ss_size; /* 1672 8 */
struct callback_head * task_works; /* 1680 8 */
struct audit_context * audit_context; /* 1688 8 */
kuid_t loginuid; /* 1696 4 */
unsigned int sessionid; /* 1700 4 */
struct seccomp seccomp; /* 1704 16 */
u32 parent_exec_id; /* 1720 4 */
u32 self_exec_id; /* 1724 4 */
/* --- cacheline 27 boundary (1728 bytes) --- */
spinlock_t alloc_lock; /* 1728 4 */
raw_spinlock_t pi_lock; /* 1732 4 */
struct wake_q_node wake_q; /* 1736 8 */
struct rb_root pi_waiters; /* 1744 8 */
struct rb_node * pi_waiters_leftmost; /* 1752 8 */
struct rt_mutex_waiter * pi_blocked_on; /* 1760 8 */
void * journal_info; /* 1768 8 */
struct bio_list * bio_list; /* 1776 8 */
struct blk_plug * plug; /* 1784 8 */
/* --- cacheline 28 boundary (1792 bytes) --- */
struct reclaim_state * reclaim_state; /* 1792 8 */
struct backing_dev_info * backing_dev_info; /* 1800 8 */
struct io_context * io_context; /* 1808 8 */
long unsigned int ptrace_message; /* 1816 8 */
siginfo_t * last_siginfo; /* 1824 8 */
struct task_io_accounting ioac; /* 1832 56 */
/* --- cacheline 29 boundary (1856 bytes) was 32 bytes ago --- */
u64 acct_rss_mem1; /* 1888 8 */
u64 acct_vm_mem1; /* 1896 8 */
cputime_t acct_timexpd; /* 1904 8 */
nodemask_t mems_allowed; /* 1912 8 */
/* --- cacheline 30 boundary (1920 bytes) --- */
seqcount_t mems_allowed_seq; /* 1920 4 */
int cpuset_mem_spread_rotor; /* 1924 4 */
int cpuset_slab_spread_rotor; /* 1928 4 */
/* XXX 4 bytes hole, try to pack */
struct css_set * cgroups; /* 1936 8 */
struct list_head cg_list; /* 1944 16 */
struct robust_list_head * robust_list; /* 1960 8 */
struct compat_robust_list_head * compat_robust_list; /* 1968 8 */
struct list_head pi_state_list; /* 1976 16 */
/* --- cacheline 31 boundary (1984 bytes) was 8 bytes ago --- */
struct futex_pi_state * pi_state_cache; /* 1992 8 */
struct perf_event_context * perf_event_ctxp[2]; /* 2000 16 */
struct mutex perf_event_mutex; /* 2016 40 */
/* --- cacheline 32 boundary (2048 bytes) was 8 bytes ago --- */
struct list_head perf_event_list; /* 2056 16 */
struct mempolicy * mempolicy; /* 2072 8 */
short int il_next; /* 2080 2 */
short int pref_node_fork; /* 2082 2 */
int numa_scan_seq; /* 2084 4 */
unsigned int numa_scan_period; /* 2088 4 */
unsigned int numa_scan_period_max; /* 2092 4 */
int numa_preferred_nid; /* 2096 4 */
/* XXX 4 bytes hole, try to pack */
long unsigned int numa_migrate_retry; /* 2104 8 */
/* --- cacheline 33 boundary (2112 bytes) --- */
u64 node_stamp; /* 2112 8 */
u64 last_task_numa_placement; /* 2120 8 */
u64 last_sum_exec_runtime; /* 2128 8 */
struct callback_head numa_work; /* 2136 16 */
struct list_head numa_entry; /* 2152 16 */
struct numa_group * numa_group; /* 2168 8 */
/* --- cacheline 34 boundary (2176 bytes) --- */
long unsigned int * numa_faults; /* 2176 8 */
long unsigned int total_numa_faults; /* 2184 8 */
long unsigned int numa_faults_locality[3]; /* 2192 24 */
long unsigned int numa_pages_migrated; /* 2216 8 */
struct tlbflush_unmap_batch tlb_ubc; /* 2224 40 */
/* --- cacheline 35 boundary (2240 bytes) was 24 bytes ago --- */
struct callback_head rcu; /* 2264 16 */
struct pipe_inode_info * splice_pipe; /* 2280 8 */
struct page_frag task_frag; /* 2288 16 */
/* --- cacheline 36 boundary (2304 bytes) --- */
struct task_delay_info * delays; /* 2304 8 */
int nr_dirtied; /* 2312 4 */
int nr_dirtied_pause; /* 2316 4 */
long unsigned int dirty_paused_when; /* 2320 8 */
int latency_record_count; /* 2328 4 */
/* XXX 4 bytes hole, try to pack */
struct latency_record latency_record[32]; /* 2336 3840 */
/* --- cacheline 96 boundary (6144 bytes) was 32 bytes ago --- */
long unsigned int timer_slack_ns; /* 6176 8 */
long unsigned int default_timer_slack_ns; /* 6184 8 */
int curr_ret_stack; /* 6192 4 */
/* XXX 4 bytes hole, try to pack */
struct ftrace_ret_stack * ret_stack; /* 6200 8 */
/* --- cacheline 97 boundary (6208 bytes) --- */
long long unsigned int ftrace_timestamp; /* 6208 8 */
atomic_t trace_overrun; /* 6216 4 */
atomic_t tracing_graph_pause; /* 6220 4 */
long unsigned int trace; /* 6224 8 */
long unsigned int trace_recursion; /* 6232 8 */
struct mem_cgroup * memcg_in_oom; /* 6240 8 */
gfp_t memcg_oom_gfp_mask; /* 6248 4 */
int memcg_oom_order; /* 6252 4 */
unsigned int memcg_nr_pages_over_high; /* 6256 4 */
/* XXX 4 bytes hole, try to pack */
struct uprobe_task * utask; /* 6264 8 */
/* --- cacheline 98 boundary (6272 bytes) --- */
unsigned int sequential_io; /* 6272 4 */
unsigned int sequential_io_avg; /* 6276 4 */
int pagefault_disabled; /* 6280 4 */
/* XXX 52 bytes hole, try to pack */
/* --- cacheline 99 boundary (6336 bytes) --- */
struct thread_struct thread; /* 6336 4352 */
/* --- cacheline 167 boundary (10688 bytes) --- */
/* size: 10688, cachelines: 167, members: 184 */
/* sum members: 10596, holes: 11, sum holes: 92 */
/* bit holes: 2, sum bit holes: 57 bits */
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment