diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 115af05ecabd..cbf2a3b46280 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -100,7 +100,7 @@ struct robust_list_head; | |||
100 | struct bio; | 100 | struct bio; |
101 | struct fs_struct; | 101 | struct fs_struct; |
102 | struct bts_context; | 102 | struct bts_context; |
103 | struct perf_counter_context; | 103 | struct perf_event_context; |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * List of flags we want to share for kernel threads, | 106 | * List of flags we want to share for kernel threads, |
@@ -140,6 +140,10 @@ extern int nr_processes(void); | |||
140 | extern unsigned long nr_running(void); | 140 | extern unsigned long nr_running(void); |
141 | extern unsigned long nr_uninterruptible(void); | 141 | extern unsigned long nr_uninterruptible(void); |
142 | extern unsigned long nr_iowait(void); | 142 | extern unsigned long nr_iowait(void); |
143 | extern unsigned long nr_iowait_cpu(void); | ||
144 | extern unsigned long this_cpu_load(void); | ||
145 | |||
146 | |||
143 | extern void calc_global_load(void); | 147 | extern void calc_global_load(void); |
144 | extern u64 cpu_nr_migrations(int cpu); | 148 | extern u64 cpu_nr_migrations(int cpu); |
145 | 149 | ||
@@ -422,6 +426,15 @@ static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm) | |||
422 | return max(mm->hiwater_rss, get_mm_rss(mm)); | 426 | return max(mm->hiwater_rss, get_mm_rss(mm)); |
423 | } | 427 | } |
424 | 428 | ||
429 | static inline void setmax_mm_hiwater_rss(unsigned long *maxrss, | ||
430 | struct mm_struct *mm) | ||
431 | { | ||
432 | unsigned long hiwater_rss = get_mm_hiwater_rss(mm); | ||
433 | |||
434 | if (*maxrss < hiwater_rss) | ||
435 | *maxrss = hiwater_rss; | ||
436 | } | ||
437 | |||
425 | static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm) | 438 | static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm) |
426 | { | 439 | { |
427 | return max(mm->hiwater_vm, mm->total_vm); | 440 | return max(mm->hiwater_vm, mm->total_vm); |
@@ -434,7 +447,9 @@ extern int get_dumpable(struct mm_struct *mm); | |||
434 | /* dumpable bits */ | 447 | /* dumpable bits */ |
435 | #define MMF_DUMPABLE 0 /* core dump is permitted */ | 448 | #define MMF_DUMPABLE 0 /* core dump is permitted */ |
436 | #define MMF_DUMP_SECURELY 1 /* core file is readable only by root */ | 449 | #define MMF_DUMP_SECURELY 1 /* core file is readable only by root */ |
450 | |||
437 | #define MMF_DUMPABLE_BITS 2 | 451 | #define MMF_DUMPABLE_BITS 2 |
452 | #define MMF_DUMPABLE_MASK ((1 << MMF_DUMPABLE_BITS) - 1) | ||
438 | 453 | ||
439 | /* coredump filter bits */ | 454 | /* coredump filter bits */ |
440 | #define MMF_DUMP_ANON_PRIVATE 2 | 455 | #define MMF_DUMP_ANON_PRIVATE 2 |
@@ -444,6 +459,7 @@ extern int get_dumpable(struct mm_struct *mm); | |||
444 | #define MMF_DUMP_ELF_HEADERS 6 | 459 | #define MMF_DUMP_ELF_HEADERS 6 |
445 | #define MMF_DUMP_HUGETLB_PRIVATE 7 | 460 | #define MMF_DUMP_HUGETLB_PRIVATE 7 |
446 | #define MMF_DUMP_HUGETLB_SHARED 8 | 461 | #define MMF_DUMP_HUGETLB_SHARED 8 |
462 | |||
447 | #define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS | 463 | #define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS |
448 | #define MMF_DUMP_FILTER_BITS 7 | 464 | #define MMF_DUMP_FILTER_BITS 7 |
449 | #define MMF_DUMP_FILTER_MASK \ | 465 | #define MMF_DUMP_FILTER_MASK \ |
@@ -457,6 +473,10 @@ extern int get_dumpable(struct mm_struct *mm); | |||
457 | #else | 473 | #else |
458 | # define MMF_DUMP_MASK_DEFAULT_ELF 0 | 474 | # define MMF_DUMP_MASK_DEFAULT_ELF 0 |
459 | #endif | 475 | #endif |
476 | /* leave room for more dump flags */ | ||
477 | #define MMF_VM_MERGEABLE 16 /* KSM may merge identical pages */ | ||
478 | |||
479 | #define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK) | ||
460 | 480 | ||
461 | struct sighand_struct { | 481 | struct sighand_struct { |
462 | atomic_t count; | 482 | atomic_t count; |
@@ -473,6 +493,13 @@ struct pacct_struct { | |||
473 | unsigned long ac_minflt, ac_majflt; | 493 | unsigned long ac_minflt, ac_majflt; |
474 | }; | 494 | }; |
475 | 495 | ||
496 | struct cpu_itimer { | ||
497 | cputime_t expires; | ||
498 | cputime_t incr; | ||
499 | u32 error; | ||
500 | u32 incr_error; | ||
501 | }; | ||
502 | |||
476 | /** | 503 | /** |
477 | * struct task_cputime - collected CPU time counts | 504 | * struct task_cputime - collected CPU time counts |
478 | * @utime: time spent in user mode, in &cputime_t units | 505 | * @utime: time spent in user mode, in &cputime_t units |
@@ -567,9 +594,12 @@ struct signal_struct { | |||
567 | struct pid *leader_pid; | 594 | struct pid *leader_pid; |
568 | ktime_t it_real_incr; | 595 | ktime_t it_real_incr; |
569 | 596 | ||
570 | /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ | 597 | /* |
571 | cputime_t it_prof_expires, it_virt_expires; | 598 | * ITIMER_PROF and ITIMER_VIRTUAL timers for the process, we use |
572 | cputime_t it_prof_incr, it_virt_incr; | 599 | * CPUCLOCK_PROF and CPUCLOCK_VIRT for indexing array as these |
600 | * values are defined to 0 and 1 respectively | ||
601 | */ | ||
602 | struct cpu_itimer it[2]; | ||
573 | 603 | ||
574 | /* | 604 | /* |
575 | * Thread group totals for process CPU timers. | 605 | * Thread group totals for process CPU timers. |
@@ -601,6 +631,7 @@ struct signal_struct { | |||
601 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; | 631 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; |
602 | unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; | 632 | unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; |
603 | unsigned long inblock, oublock, cinblock, coublock; | 633 | unsigned long inblock, oublock, cinblock, coublock; |
634 | unsigned long maxrss, cmaxrss; | ||
604 | struct task_io_accounting ioac; | 635 | struct task_io_accounting ioac; |
605 | 636 | ||
606 | /* | 637 | /* |
@@ -632,6 +663,8 @@ struct signal_struct { | |||
632 | unsigned audit_tty; | 663 | unsigned audit_tty; |
633 | struct tty_audit_buf *tty_audit_buf; | 664 | struct tty_audit_buf *tty_audit_buf; |
634 | #endif | 665 | #endif |
666 | |||
667 | int oom_adj; /* OOM kill score adjustment (bit shift) */ | ||
635 | }; | 668 | }; |
636 | 669 | ||
637 | /* Context switch must be unlocked if interrupts are to be enabled */ | 670 | /* Context switch must be unlocked if interrupts are to be enabled */ |
@@ -701,7 +734,7 @@ struct user_struct { | |||
701 | #endif | 734 | #endif |
702 | #endif | 735 | #endif |
703 | 736 | ||
704 | #ifdef CONFIG_PERF_COUNTERS | 737 | #ifdef CONFIG_PERF_EVENTS |
705 | atomic_long_t locked_vm; | 738 | atomic_long_t locked_vm; |
706 | #endif | 739 | #endif |
707 | }; | 740 | }; |
@@ -1214,7 +1247,6 @@ struct task_struct { | |||
1214 | * a short time | 1247 | * a short time |
1215 | */ | 1248 | */ |
1216 | unsigned char fpu_counter; | 1249 | unsigned char fpu_counter; |
1217 | s8 oomkilladj; /* OOM kill score adjustment (bit shift). */ | ||
1218 | #ifdef CONFIG_BLK_DEV_IO_TRACE | 1250 | #ifdef CONFIG_BLK_DEV_IO_TRACE |
1219 | unsigned int btrace_seq; | 1251 | unsigned int btrace_seq; |
1220 | #endif | 1252 | #endif |
@@ -1451,10 +1483,10 @@ struct task_struct { | |||
1451 | struct list_head pi_state_list; | 1483 | struct list_head pi_state_list; |
1452 | struct futex_pi_state *pi_state_cache; | 1484 | struct futex_pi_state *pi_state_cache; |
1453 | #endif | 1485 | #endif |
1454 | #ifdef CONFIG_PERF_COUNTERS | 1486 | #ifdef CONFIG_PERF_EVENTS |
1455 | struct perf_counter_context *perf_counter_ctxp; | 1487 | struct perf_event_context *perf_event_ctxp; |
1456 | struct mutex perf_counter_mutex; | 1488 | struct mutex perf_event_mutex; |
1457 | struct list_head perf_counter_list; | 1489 | struct list_head perf_event_list; |
1458 | #endif | 1490 | #endif |
1459 | #ifdef CONFIG_NUMA | 1491 | #ifdef CONFIG_NUMA |
1460 | struct mempolicy *mempolicy; /* Protected by alloc_lock */ | 1492 | struct mempolicy *mempolicy; /* Protected by alloc_lock */ |
@@ -1507,6 +1539,7 @@ struct task_struct { | |||
1507 | /* bitmask of trace recursion */ | 1539 | /* bitmask of trace recursion */ |
1508 | unsigned long trace_recursion; | 1540 | unsigned long trace_recursion; |
1509 | #endif /* CONFIG_TRACING */ | 1541 | #endif /* CONFIG_TRACING */ |
1542 | unsigned long stack_start; | ||
1510 | }; | 1543 | }; |
1511 | 1544 | ||
1512 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ | 1545 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ |
@@ -1713,7 +1746,7 @@ extern cputime_t task_gtime(struct task_struct *p); | |||
1713 | #define PF_FROZEN 0x00010000 /* frozen for system suspend */ | 1746 | #define PF_FROZEN 0x00010000 /* frozen for system suspend */ |
1714 | #define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ | 1747 | #define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ |
1715 | #define PF_KSWAPD 0x00040000 /* I am kswapd */ | 1748 | #define PF_KSWAPD 0x00040000 /* I am kswapd */ |
1716 | #define PF_SWAPOFF 0x00080000 /* I am in swapoff */ | 1749 | #define PF_OOM_ORIGIN 0x00080000 /* Allocating much memory to others */ |
1717 | #define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ | 1750 | #define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ |
1718 | #define PF_KTHREAD 0x00200000 /* I am a kernel thread */ | 1751 | #define PF_KTHREAD 0x00200000 /* I am a kernel thread */ |
1719 | #define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ | 1752 | #define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ |