diff options
Diffstat (limited to 'include/linux/sched.h')
| -rw-r--r-- | include/linux/sched.h | 66 | 
1 files changed, 38 insertions, 28 deletions
| diff --git a/include/linux/sched.h b/include/linux/sched.h index c1a927ddec64..78c351e35fec 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -503,6 +503,8 @@ struct sched_statistics {  	u64				block_start;  	u64				block_max; +	s64				sum_block_runtime; +  	u64				exec_max;  	u64				slice_max; @@ -522,7 +524,7 @@ struct sched_statistics {  	u64				nr_wakeups_passive;  	u64				nr_wakeups_idle;  #endif -}; +} ____cacheline_aligned;  struct sched_entity {  	/* For load-balancing: */ @@ -538,8 +540,6 @@ struct sched_entity {  	u64				nr_migrations; -	struct sched_statistics		statistics; -  #ifdef CONFIG_FAIR_GROUP_SCHED  	int				depth;  	struct sched_entity		*parent; @@ -750,10 +750,6 @@ struct task_struct {  #ifdef CONFIG_SMP  	int				on_cpu;  	struct __call_single_node	wake_entry; -#ifdef CONFIG_THREAD_INFO_IN_TASK -	/* Current CPU: */ -	unsigned int			cpu; -#endif  	unsigned int			wakee_flips;  	unsigned long			wakee_flip_decay_ts;  	struct task_struct		*last_wakee; @@ -775,10 +771,10 @@ struct task_struct {  	int				normal_prio;  	unsigned int			rt_priority; -	const struct sched_class	*sched_class;  	struct sched_entity		se;  	struct sched_rt_entity		rt;  	struct sched_dl_entity		dl; +	const struct sched_class	*sched_class;  #ifdef CONFIG_SCHED_CORE  	struct rb_node			core_node; @@ -803,6 +799,8 @@ struct task_struct {  	struct uclamp_se		uclamp[UCLAMP_CNT];  #endif +	struct sched_statistics         stats; +  #ifdef CONFIG_PREEMPT_NOTIFIERS  	/* List of struct preempt_notifier: */  	struct hlist_head		preempt_notifiers; @@ -1160,10 +1158,8 @@ struct task_struct {  	/* Stacked block device info: */  	struct bio_list			*bio_list; -#ifdef CONFIG_BLOCK  	/* Stack plugging: */  	struct blk_plug			*plug; -#endif  	/* VM state: */  	struct reclaim_state		*reclaim_state; @@ -1665,6 +1661,7 @@ extern struct pid *cad_pid;  #define PF_VCPU			0x00000001	/* I'm a virtual CPU */  #define PF_IDLE			0x00000002	/* I am an IDLE thread */  #define PF_EXITING		0x00000004	/* Getting shut down */ +#define PF_POSTCOREDUMP		0x00000008	/* Coredumps should ignore this task */  #define PF_IO_WORKER		0x00000010	/* Task is an IO worker */  #define PF_WQ_WORKER		0x00000020	/* I'm a workqueue worker */  #define PF_FORKNOEXEC		0x00000040	/* Forked but didn't exec */ @@ -1886,10 +1883,7 @@ extern struct thread_info init_thread_info;  extern unsigned long init_stack[THREAD_SIZE / sizeof(unsigned long)];  #ifdef CONFIG_THREAD_INFO_IN_TASK -static inline struct thread_info *task_thread_info(struct task_struct *task) -{ -	return &task->thread_info; -} +# define task_thread_info(task)	(&(task)->thread_info)  #elif !defined(__HAVE_THREAD_FUNCTIONS)  # define task_thread_info(task)	((struct thread_info *)(task)->stack)  #endif @@ -2039,7 +2033,7 @@ static inline int _cond_resched(void) { return 0; }  #endif /* !defined(CONFIG_PREEMPTION) || defined(CONFIG_PREEMPT_DYNAMIC) */  #define cond_resched() ({			\ -	___might_sleep(__FILE__, __LINE__, 0);	\ +	__might_resched(__FILE__, __LINE__, 0);	\  	_cond_resched();			\  }) @@ -2047,19 +2041,38 @@ extern int __cond_resched_lock(spinlock_t *lock);  extern int __cond_resched_rwlock_read(rwlock_t *lock);  extern int __cond_resched_rwlock_write(rwlock_t *lock); -#define cond_resched_lock(lock) ({				\ -	___might_sleep(__FILE__, __LINE__, PREEMPT_LOCK_OFFSET);\ -	__cond_resched_lock(lock);				\ +#define MIGHT_RESCHED_RCU_SHIFT		8 +#define MIGHT_RESCHED_PREEMPT_MASK	((1U << MIGHT_RESCHED_RCU_SHIFT) - 1) + +#ifndef CONFIG_PREEMPT_RT +/* + * Non RT kernels have an elevated preempt count due to the held lock, + * but are not allowed to be inside a RCU read side critical section + */ +# define PREEMPT_LOCK_RESCHED_OFFSETS	PREEMPT_LOCK_OFFSET +#else +/* + * spin/rw_lock() on RT implies rcu_read_lock(). The might_sleep() check in + * cond_resched*lock() has to take that into account because it checks for + * preempt_count() and rcu_preempt_depth(). + */ +# define PREEMPT_LOCK_RESCHED_OFFSETS	\ +	(PREEMPT_LOCK_OFFSET + (1U << MIGHT_RESCHED_RCU_SHIFT)) +#endif + +#define cond_resched_lock(lock) ({						\ +	__might_resched(__FILE__, __LINE__, PREEMPT_LOCK_RESCHED_OFFSETS);	\ +	__cond_resched_lock(lock);						\  }) -#define cond_resched_rwlock_read(lock) ({			\ -	__might_sleep(__FILE__, __LINE__, PREEMPT_LOCK_OFFSET);	\ -	__cond_resched_rwlock_read(lock);			\ +#define cond_resched_rwlock_read(lock) ({					\ +	__might_resched(__FILE__, __LINE__, PREEMPT_LOCK_RESCHED_OFFSETS);	\ +	__cond_resched_rwlock_read(lock);					\  }) -#define cond_resched_rwlock_write(lock) ({			\ -	__might_sleep(__FILE__, __LINE__, PREEMPT_LOCK_OFFSET);	\ -	__cond_resched_rwlock_write(lock);			\ +#define cond_resched_rwlock_write(lock) ({					\ +	__might_resched(__FILE__, __LINE__, PREEMPT_LOCK_RESCHED_OFFSETS);	\ +	__cond_resched_rwlock_write(lock);					\  })  static inline void cond_resched_rcu(void) @@ -2114,11 +2127,7 @@ static __always_inline bool need_resched(void)  static inline unsigned int task_cpu(const struct task_struct *p)  { -#ifdef CONFIG_THREAD_INFO_IN_TASK -	return READ_ONCE(p->cpu); -#else  	return READ_ONCE(task_thread_info(p)->cpu); -#endif  }  extern void set_task_cpu(struct task_struct *p, unsigned int cpu); @@ -2137,6 +2146,7 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)  #endif /* CONFIG_SMP */  extern bool sched_task_on_rq(struct task_struct *p); +extern unsigned long get_wchan(struct task_struct *p);  /*   * In order to reduce various lock holder preemption latencies provide an |