Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4fde846a authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Thomas Gleixner:
 "This scheduler update provides:

   - The (hopefully) final fix for the vtime accounting issues which
     were around for quite some time

   - Use types known to user space in UAPI headers to unbreak user space
     builds

   - Make load balancing respect the current scheduling domain again
     instead of evaluating unrelated CPUs"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/headers/uapi: Fix linux/sched/types.h userspace compilation errors
  sched/fair: Fix load_balance() affinity redo path
  sched/cputime: Accumulate vtime on top of nsec clocksource
  sched/cputime: Move the vtime task fields to their own struct
  sched/cputime: Rename vtime fields
  sched/cputime: Always set tsk->vtime_snap_whence after accounting vtime
  vtime, sched/cputime: Remove vtime_account_user()
  Revert "sched/cputime: Refactor the cputime_adjust() code"
parents c3931a87 242fc352
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -170,9 +170,9 @@ extern struct cred init_cred;

#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
# define INIT_VTIME(tsk)						\
	.vtime_seqcount = SEQCNT_ZERO(tsk.vtime_seqcount),	\
	.vtime_snap = 0,				\
	.vtime_snap_whence = VTIME_SYS,
	.vtime.seqcount = SEQCNT_ZERO(tsk.vtime.seqcount),		\
	.vtime.starttime = 0,						\
	.vtime.state = VTIME_SYS,
#else
# define INIT_VTIME(tsk)
#endif
+19 −10
Original line number Diff line number Diff line
@@ -223,6 +223,24 @@ struct task_cputime {
#define prof_exp			stime
#define sched_exp			sum_exec_runtime

enum vtime_state {
	/* Task is sleeping or running in a CPU with VTIME inactive: */
	VTIME_INACTIVE = 0,
	/* Task runs in userspace in a CPU with VTIME active: */
	VTIME_USER,
	/* Task runs in kernelspace in a CPU with VTIME active: */
	VTIME_SYS,
};

struct vtime {
	seqcount_t		seqcount;
	unsigned long long	starttime;
	enum vtime_state	state;
	u64			utime;
	u64			stime;
	u64			gtime;
};

struct sched_info {
#ifdef CONFIG_SCHED_INFO
	/* Cumulative counters: */
@@ -688,16 +706,7 @@ struct task_struct {
	u64				gtime;
	struct prev_cputime		prev_cputime;
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
	seqcount_t			vtime_seqcount;
	unsigned long long		vtime_snap;
	enum {
		/* Task is sleeping or running in a CPU with VTIME inactive: */
		VTIME_INACTIVE = 0,
		/* Task runs in userspace in a CPU with VTIME active: */
		VTIME_USER,
		/* Task runs in kernelspace in a CPU with VTIME active: */
		VTIME_SYS,
	} vtime_snap_whence;
	struct vtime			vtime;
#endif

#ifdef CONFIG_NO_HZ_FULL
+1 −8
Original line number Diff line number Diff line
@@ -67,19 +67,12 @@ static inline void vtime_account_system(struct task_struct *tsk) { }

#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
extern void arch_vtime_task_switch(struct task_struct *tsk);
extern void vtime_account_user(struct task_struct *tsk);
extern void vtime_user_enter(struct task_struct *tsk);

static inline void vtime_user_exit(struct task_struct *tsk)
{
	vtime_account_user(tsk);
}

extern void vtime_user_exit(struct task_struct *tsk);
extern void vtime_guest_enter(struct task_struct *tsk);
extern void vtime_guest_exit(struct task_struct *tsk);
extern void vtime_init_idle(struct task_struct *tsk, int cpu);
#else /* !CONFIG_VIRT_CPU_ACCOUNTING_GEN  */
static inline void vtime_account_user(struct task_struct *tsk) { }
static inline void vtime_user_enter(struct task_struct *tsk) { }
static inline void vtime_user_exit(struct task_struct *tsk) { }
static inline void vtime_guest_enter(struct task_struct *tsk) { }
+8 −8
Original line number Diff line number Diff line
@@ -54,21 +54,21 @@ struct sched_param {
 * available in the scheduling class file or in Documentation/.
 */
struct sched_attr {
	u32 size;
	__u32 size;

	u32 sched_policy;
	u64 sched_flags;
	__u32 sched_policy;
	__u64 sched_flags;

	/* SCHED_NORMAL, SCHED_BATCH */
	s32 sched_nice;
	__s32 sched_nice;

	/* SCHED_FIFO, SCHED_RR */
	u32 sched_priority;
	__u32 sched_priority;

	/* SCHED_DEADLINE */
	u64 sched_runtime;
	u64 sched_deadline;
	u64 sched_period;
	__u64 sched_runtime;
	__u64 sched_deadline;
	__u64 sched_period;
};

#endif /* _UAPI_LINUX_SCHED_TYPES_H */
+3 −3
Original line number Diff line number Diff line
@@ -1637,9 +1637,9 @@ static __latent_entropy struct task_struct *copy_process(
	prev_cputime_init(&p->prev_cputime);

#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
	seqcount_init(&p->vtime_seqcount);
	p->vtime_snap = 0;
	p->vtime_snap_whence = VTIME_INACTIVE;
	seqcount_init(&p->vtime.seqcount);
	p->vtime.starttime = 0;
	p->vtime.state = VTIME_INACTIVE;
#endif

#if defined(SPLIT_RSS_COUNTING)
Loading