aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h63
1 files changed, 61 insertions, 2 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1c876e27ff93..34ed0d99b1bd 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -463,6 +463,10 @@ struct signal_struct {
463#ifdef CONFIG_BSD_PROCESS_ACCT 463#ifdef CONFIG_BSD_PROCESS_ACCT
464 struct pacct_struct pacct; /* per-process accounting information */ 464 struct pacct_struct pacct; /* per-process accounting information */
465#endif 465#endif
466#ifdef CONFIG_TASKSTATS
467 spinlock_t stats_lock;
468 struct taskstats *stats;
469#endif
466}; 470};
467 471
468/* Context switch must be unlocked if interrupts are to be enabled */ 472/* Context switch must be unlocked if interrupts are to be enabled */
@@ -537,7 +541,7 @@ extern struct user_struct root_user;
537struct backing_dev_info; 541struct backing_dev_info;
538struct reclaim_state; 542struct reclaim_state;
539 543
540#ifdef CONFIG_SCHEDSTATS 544#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
541struct sched_info { 545struct sched_info {
542 /* cumulative counters */ 546 /* cumulative counters */
543 unsigned long cpu_time, /* time spent on the cpu */ 547 unsigned long cpu_time, /* time spent on the cpu */
@@ -548,9 +552,53 @@ struct sched_info {
548 unsigned long last_arrival, /* when we last ran on a cpu */ 552 unsigned long last_arrival, /* when we last ran on a cpu */
549 last_queued; /* when we were last queued to run */ 553 last_queued; /* when we were last queued to run */
550}; 554};
555#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
551 556
557#ifdef CONFIG_SCHEDSTATS
552extern struct file_operations proc_schedstat_operations; 558extern struct file_operations proc_schedstat_operations;
559#endif /* CONFIG_SCHEDSTATS */
560
561#ifdef CONFIG_TASK_DELAY_ACCT
562struct task_delay_info {
563 spinlock_t lock;
564 unsigned int flags; /* Private per-task flags */
565
566 /* For each stat XXX, add following, aligned appropriately
567 *
568 * struct timespec XXX_start, XXX_end;
569 * u64 XXX_delay;
570 * u32 XXX_count;
571 *
572 * Atomicity of updates to XXX_delay, XXX_count protected by
573 * single lock above (split into XXX_lock if contention is an issue).
574 */
575
576 /*
577 * XXX_count is incremented on every XXX operation, the delay
578 * associated with the operation is added to XXX_delay.
579 * XXX_delay contains the accumulated delay time in nanoseconds.
580 */
581 struct timespec blkio_start, blkio_end; /* Shared by blkio, swapin */
582 u64 blkio_delay; /* wait for sync block io completion */
583 u64 swapin_delay; /* wait for swapin block io completion */
584 u32 blkio_count; /* total count of the number of sync block */
585 /* io operations performed */
586 u32 swapin_count; /* total count of the number of swapin block */
587 /* io operations performed */
588};
589#endif /* CONFIG_TASK_DELAY_ACCT */
590
591static inline int sched_info_on(void)
592{
593#ifdef CONFIG_SCHEDSTATS
594 return 1;
595#elif defined(CONFIG_TASK_DELAY_ACCT)
596 extern int delayacct_on;
597 return delayacct_on;
598#else
599 return 0;
553#endif 600#endif
601}
554 602
555enum idle_type 603enum idle_type
556{ 604{
@@ -747,7 +795,7 @@ struct task_struct {
747 cpumask_t cpus_allowed; 795 cpumask_t cpus_allowed;
748 unsigned int time_slice, first_time_slice; 796 unsigned int time_slice, first_time_slice;
749 797
750#ifdef CONFIG_SCHEDSTATS 798#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
751 struct sched_info sched_info; 799 struct sched_info sched_info;
752#endif 800#endif
753 801
@@ -945,6 +993,9 @@ struct task_struct {
945 * cache last used pipe for splice 993 * cache last used pipe for splice
946 */ 994 */
947 struct pipe_inode_info *splice_pipe; 995 struct pipe_inode_info *splice_pipe;
996#ifdef CONFIG_TASK_DELAY_ACCT
997 struct task_delay_info *delays;
998#endif
948}; 999};
949 1000
950static inline pid_t process_group(struct task_struct *tsk) 1001static inline pid_t process_group(struct task_struct *tsk)
@@ -1506,6 +1557,14 @@ static inline void freeze(struct task_struct *p)
1506} 1557}
1507 1558
1508/* 1559/*
1560 * Sometimes we may need to cancel the previous 'freeze' request
1561 */
1562static inline void do_not_freeze(struct task_struct *p)
1563{
1564 p->flags &= ~PF_FREEZE;
1565}
1566
1567/*
1509 * Wake up a frozen process 1568 * Wake up a frozen process
1510 */ 1569 */
1511static inline int thaw_process(struct task_struct *p) 1570static inline int thaw_process(struct task_struct *p)