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

Commit 0b981cb9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull scheduler changes from Ingo Molnar:
 "Continued quest to clean up and enhance the cputime code by Frederic
  Weisbecker, in preparation for future tickless kernel features.

  Other than that, smallish changes."

Fix up trivial conflicts due to additions next to each other in arch/{x86/}Kconfig

* 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
  cputime: Make finegrained irqtime accounting generally available
  cputime: Gather time/stats accounting config options into a single menu
  ia64: Reuse system and user vtime accounting functions on task switch
  ia64: Consolidate user vtime accounting
  vtime: Consolidate system/idle context detection
  cputime: Use a proper subsystem naming for vtime related APIs
  sched: cpu_power: enable ARCH_POWER
  sched/nohz: Clean up select_nohz_load_balancer()
  sched: Fix load avg vs. cpu-hotplug
  sched: Remove __ARCH_WANT_INTERRUPTS_ON_CTXSW
  sched: Fix nohz_idle_balance()
  sched: Remove useless code in yield_to()
  sched: Add time unit suffix to sched sysctl knobs
  sched/debug: Limit sd->*_idx range on sysctl
  sched: Remove AFFINE_WAKEUPS feature flag
  s390: Remove leftover account_tick_vtime() header
  cputime: Consolidate vtime handling on context switch
  sched: Move cputime code to its own file
  cputime: Generalize CONFIG_VIRT_CPU_ACCOUNTING
  tile: Remove SD_PREFER_LOCAL leftover
  ...
parents 4cba3335 fdf9c356
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -17,16 +17,6 @@ you must `#define __ARCH_WANT_UNLOCKED_CTXSW` in a header file
Unlocked context switches introduce only a very minor performance
penalty to the core scheduler implementation in the CONFIG_SMP case.

2. Interrupt status
By default, the switch_to arch function is called with interrupts
disabled. Interrupts may be enabled over the call if it is likely to
introduce a significant interrupt latency by adding the line
`#define __ARCH_WANT_INTERRUPTS_ON_CTXSW` in the same place as for
unlocked context switches. This define also implies
`__ARCH_WANT_UNLOCKED_CTXSW`. See arch/arm/include/asm/system.h for an
example.


CPU idle
========
Your cpu_idle routines need to obey the following rules:
+9 −0
Original line number Diff line number Diff line
@@ -304,4 +304,13 @@ config HAVE_RCU_USER_QS
	  are already protected inside rcu_irq_enter/rcu_irq_exit() but
	  preemption or signal handling on irq exit still need to be protected.

config HAVE_VIRT_CPU_ACCOUNTING
	bool

config HAVE_IRQ_TIME_ACCOUNTING
	bool
	help
	  Archs need to ensure they use a high enough resolution clock to
	  support irq time accounting and then call enable_sched_clock_irqtime().

source "kernel/gcov/Kconfig"
+1 −11
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ config IA64
	select HAVE_GENERIC_HARDIRQS
	select HAVE_MEMBLOCK
	select HAVE_MEMBLOCK_NODE_MAP
	select HAVE_VIRT_CPU_ACCOUNTING
	select ARCH_DISCARD_MEMBLOCK
	select GENERIC_IRQ_PROBE
	select GENERIC_PENDING_IRQ if SMP
@@ -340,17 +341,6 @@ config FORCE_MAX_ZONEORDER
	default "17" if HUGETLB_PAGE
	default "11"

config VIRT_CPU_ACCOUNTING
	bool "Deterministic task and CPU time accounting"
	default n
	help
	  Select this option to enable more accurate task and CPU time
	  accounting.  This is done by reading a CPU counter on each
	  kernel entry and exit and on transitions within the kernel
	  between system, softirq and hardirq state, so there is a
	  small performance impact.
	  If in doubt, say N here.

config SMP
	bool "Symmetric multi-processing support"
	select USE_GENERIC_SMP_HELPERS
+0 −8
Original line number Diff line number Diff line
@@ -30,13 +30,6 @@ extern struct task_struct *ia64_switch_to (void *next_task);
extern void ia64_save_extra (struct task_struct *task);
extern void ia64_load_extra (struct task_struct *task);

#ifdef CONFIG_VIRT_CPU_ACCOUNTING
extern void ia64_account_on_switch (struct task_struct *prev, struct task_struct *next);
# define IA64_ACCOUNT_ON_SWITCH(p,n) ia64_account_on_switch(p,n)
#else
# define IA64_ACCOUNT_ON_SWITCH(p,n)
#endif

#ifdef CONFIG_PERFMON
  DECLARE_PER_CPU(unsigned long, pfm_syst_info);
# define PERFMON_IS_SYSWIDE() (__get_cpu_var(pfm_syst_info) & 0x1)
@@ -49,7 +42,6 @@ extern void ia64_account_on_switch (struct task_struct *prev, struct task_struct
	 || PERFMON_IS_SYSWIDE())

#define __switch_to(prev,next,last) do {							 \
	IA64_ACCOUNT_ON_SWITCH(prev, next);							 \
	if (IA64_HAS_EXTRA_STATE(prev))								 \
		ia64_save_extra(prev);								 \
	if (IA64_HAS_EXTRA_STATE(next))								 \
+33 −33
Original line number Diff line number Diff line
@@ -83,32 +83,36 @@ static struct clocksource *itc_clocksource;

extern cputime_t cycle_to_cputime(u64 cyc);

static void vtime_account_user(struct task_struct *tsk)
{
	cputime_t delta_utime;
	struct thread_info *ti = task_thread_info(tsk);

	if (ti->ac_utime) {
		delta_utime = cycle_to_cputime(ti->ac_utime);
		account_user_time(tsk, delta_utime, delta_utime);
		ti->ac_utime = 0;
	}
}

/*
 * Called from the context switch with interrupts disabled, to charge all
 * accumulated times to the current process, and to prepare accounting on
 * the next process.
 */
void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next)
void vtime_task_switch(struct task_struct *prev)
{
	struct thread_info *pi = task_thread_info(prev);
	struct thread_info *ni = task_thread_info(next);
	cputime_t delta_stime, delta_utime;
	__u64 now;
	struct thread_info *ni = task_thread_info(current);

	now = ia64_get_itc();

	delta_stime = cycle_to_cputime(pi->ac_stime + (now - pi->ac_stamp));
	if (idle_task(smp_processor_id()) != prev)
		account_system_time(prev, 0, delta_stime, delta_stime);
		vtime_account_system(prev);
	else
		account_idle_time(delta_stime);
		vtime_account_idle(prev);

	if (pi->ac_utime) {
		delta_utime = cycle_to_cputime(pi->ac_utime);
		account_user_time(prev, delta_utime, delta_utime);
	}
	vtime_account_user(prev);

	pi->ac_stamp = ni->ac_stamp = now;
	pi->ac_stamp = ni->ac_stamp;
	ni->ac_stime = ni->ac_utime = 0;
}

@@ -116,29 +120,32 @@ void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next)
 * Account time for a transition between system, hard irq or soft irq state.
 * Note that this function is called with interrupts enabled.
 */
void account_system_vtime(struct task_struct *tsk)
static cputime_t vtime_delta(struct task_struct *tsk)
{
	struct thread_info *ti = task_thread_info(tsk);
	unsigned long flags;
	cputime_t delta_stime;
	__u64 now;

	local_irq_save(flags);

	now = ia64_get_itc();

	delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp));
	if (irq_count() || idle_task(smp_processor_id()) != tsk)
		account_system_time(tsk, 0, delta_stime, delta_stime);
	else
		account_idle_time(delta_stime);
	ti->ac_stime = 0;

	ti->ac_stamp = now;

	local_irq_restore(flags);
	return delta_stime;
}

void vtime_account_system(struct task_struct *tsk)
{
	cputime_t delta = vtime_delta(tsk);

	account_system_time(tsk, 0, delta, delta);
}

void vtime_account_idle(struct task_struct *tsk)
{
	account_idle_time(vtime_delta(tsk));
}
EXPORT_SYMBOL_GPL(account_system_vtime);

/*
 * Called from the timer interrupt handler to charge accumulated user time
@@ -146,14 +153,7 @@ EXPORT_SYMBOL_GPL(account_system_vtime);
 */
void account_process_tick(struct task_struct *p, int user_tick)
{
	struct thread_info *ti = task_thread_info(p);
	cputime_t delta_utime;

	if (ti->ac_utime) {
		delta_utime = cycle_to_cputime(ti->ac_utime);
		account_user_time(p, delta_utime, delta_utime);
		ti->ac_utime = 0;
	}
	vtime_account_user(p);
}

#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
Loading