Commit adb35e8d authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'sched-core-2020-12-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler updates from Thomas Gleixner:

 - migrate_disable/enable() support which originates from the RT tree
   and is now a prerequisite for the new preemptible kmap_local() API
   which aims to replace kmap_atomic().

 - A fair amount of topology and NUMA related improvements

 - Improvements for the frequency invariant calculations

 - Enhanced robustness for the global CPU priority tracking and decision
   making

 - The usual small fixes and enhancements all over the place

* tag 'sched-core-2020-12-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (61 commits)
  sched/fair: Trivial correction of the newidle_balance() comment
  sched/fair: Clear SMT siblings after determining the core is not idle
  sched: Fix kernel-doc markup
  x86: Print ratio freq_max/freq_base used in frequency invariance calculations
  x86, sched: Use midpoint of max_boost and max_P for frequency invariance on AMD EPYC
  x86, sched: Calculate frequency invariance for AMD systems
  irq_work: Optimize irq_work_single()
  smp: Cleanup smp_call_function*()
  irq_work: Cleanup
  sched: Limit the amount of NUMA imbalance that can exist at fork time
  sched/numa: Allow a floating imbalance between NUMA nodes
  sched: Avoid unnecessary calculation of load imbalance at clone time
  sched/numa: Rename nr_running and break out the magic number
  sched: Make migrate_disable/enable() independent of RT
  sched/topology: Condition EAS enablement on FIE support
  arm64: Rebuild sched domains on invariance status changes
  sched/topology,schedutil: Wrap sched domains rebuild
  sched/uclamp: Allow to reset a task uclamp constraint value
  sched/core: Fix typos in comments
  Documentation: scheduler: fix information on arch SD flags, sched_domain and sched_debug
  ...
parents 533369b1 5b78f2dc
Loading
Loading
Loading
Loading
+11 −15
Original line number Original line Diff line number Diff line
@@ -65,21 +65,17 @@ of the SMP domain will span the entire machine, with each group having the
cpumask of a node. Or, you could do multi-level NUMA or Opteron, for example,
cpumask of a node. Or, you could do multi-level NUMA or Opteron, for example,
might have just one domain covering its one NUMA level.
might have just one domain covering its one NUMA level.


The implementor should read comments in include/linux/sched.h:
The implementor should read comments in include/linux/sched/sd_flags.h:
struct sched_domain fields, SD_FLAG_*, SD_*_INIT to get an idea of
SD_* to get an idea of the specifics and what to tune for the SD flags
the specifics and what to tune.
of a sched_domain.


Architectures may retain the regular override the default SD_*_INIT flags
Architectures may override the generic domain builder and the default SD flags
while using the generic domain builder in kernel/sched/core.c if they wish to
for a given topology level by creating a sched_domain_topology_level array and
retain the traditional SMT->SMP->NUMA topology (or some subset of that). This
calling set_sched_topology() with this array as the parameter.
can be done by #define'ing ARCH_HASH_SCHED_TUNE.

Alternatively, the architecture may completely override the generic domain
builder by #define'ing ARCH_HASH_SCHED_DOMAIN, and exporting your
arch_init_sched_domains function. This function will attach domains to all
CPUs using cpu_attach_domain.


The sched-domains debugging infrastructure can be enabled by enabling
The sched-domains debugging infrastructure can be enabled by enabling
CONFIG_SCHED_DEBUG. This enables an error checking parse of the sched domains
CONFIG_SCHED_DEBUG and adding 'sched_debug' to your cmdline. If you forgot to
which should catch most possible errors (described above). It also prints out
tweak your cmdline, you can also flip the /sys/kernel/debug/sched_debug
the domain structure in a visual format.
knob. This enables an error checking parse of the sched domains which should
catch most possible errors (described above). It also prints out the domain
structure in a visual format.
+10 −0
Original line number Original line Diff line number Diff line
@@ -223,6 +223,7 @@ static DEFINE_STATIC_KEY_FALSE(amu_fie_key);


static int __init init_amu_fie(void)
static int __init init_amu_fie(void)
{
{
	bool invariance_status = topology_scale_freq_invariant();
	cpumask_var_t valid_cpus;
	cpumask_var_t valid_cpus;
	bool have_policy = false;
	bool have_policy = false;
	int ret = 0;
	int ret = 0;
@@ -269,6 +270,15 @@ static int __init init_amu_fie(void)
	if (!topology_scale_freq_invariant())
	if (!topology_scale_freq_invariant())
		static_branch_disable(&amu_fie_key);
		static_branch_disable(&amu_fie_key);


	/*
	 * Task scheduler behavior depends on frequency invariance support,
	 * either cpufreq or counter driven. If the support status changes as
	 * a result of counter initialisation and use, retrigger the build of
	 * scheduling domains to ensure the information is propagated properly.
	 */
	if (invariance_status != topology_scale_freq_invariant())
		rebuild_sched_domains_energy();

free_valid_mask:
free_valid_mask:
	free_cpumask_var(valid_cpus);
	free_cpumask_var(valid_cpus);


+3 −2
Original line number Original line Diff line number Diff line
@@ -702,7 +702,6 @@ unsigned long arch_align_stack(unsigned long sp)
	return sp & ALMASK;
	return sp & ALMASK;
}
}


static DEFINE_PER_CPU(call_single_data_t, backtrace_csd);
static struct cpumask backtrace_csd_busy;
static struct cpumask backtrace_csd_busy;


static void handle_backtrace(void *info)
static void handle_backtrace(void *info)
@@ -711,6 +710,9 @@ static void handle_backtrace(void *info)
	cpumask_clear_cpu(smp_processor_id(), &backtrace_csd_busy);
	cpumask_clear_cpu(smp_processor_id(), &backtrace_csd_busy);
}
}


static DEFINE_PER_CPU(call_single_data_t, backtrace_csd) =
	CSD_INIT(handle_backtrace, NULL);

static void raise_backtrace(cpumask_t *mask)
static void raise_backtrace(cpumask_t *mask)
{
{
	call_single_data_t *csd;
	call_single_data_t *csd;
@@ -730,7 +732,6 @@ static void raise_backtrace(cpumask_t *mask)
		}
		}


		csd = &per_cpu(backtrace_csd, cpu);
		csd = &per_cpu(backtrace_csd, cpu);
		csd->func = handle_backtrace;
		smp_call_function_single_async(cpu, csd);
		smp_call_function_single_async(cpu, csd);
	}
	}
}
}
+6 −19
Original line number Original line Diff line number Diff line
@@ -687,36 +687,23 @@ EXPORT_SYMBOL(flush_tlb_one);


#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST


static DEFINE_PER_CPU(call_single_data_t, tick_broadcast_csd);

void tick_broadcast(const struct cpumask *mask)
{
	call_single_data_t *csd;
	int cpu;

	for_each_cpu(cpu, mask) {
		csd = &per_cpu(tick_broadcast_csd, cpu);
		smp_call_function_single_async(cpu, csd);
	}
}

static void tick_broadcast_callee(void *info)
static void tick_broadcast_callee(void *info)
{
{
	tick_receive_broadcast();
	tick_receive_broadcast();
}
}


static int __init tick_broadcast_init(void)
static DEFINE_PER_CPU(call_single_data_t, tick_broadcast_csd) =
	CSD_INIT(tick_broadcast_callee, NULL);

void tick_broadcast(const struct cpumask *mask)
{
{
	call_single_data_t *csd;
	call_single_data_t *csd;
	int cpu;
	int cpu;


	for (cpu = 0; cpu < NR_CPUS; cpu++) {
	for_each_cpu(cpu, mask) {
		csd = &per_cpu(tick_broadcast_csd, cpu);
		csd = &per_cpu(tick_broadcast_csd, cpu);
		csd->func = tick_broadcast_callee;
		smp_call_function_single_async(cpu, csd);
	}
	}

	return 0;
}
}
early_initcall(tick_broadcast_init);


#endif /* CONFIG_GENERIC_CLOCKEVENTS_BROADCAST */
#endif /* CONFIG_GENERIC_CLOCKEVENTS_BROADCAST */
+1 −3
Original line number Original line Diff line number Diff line
@@ -179,9 +179,7 @@ static void zpci_handle_fallback_irq(void)
		if (atomic_inc_return(&cpu_data->scheduled) > 1)
		if (atomic_inc_return(&cpu_data->scheduled) > 1)
			continue;
			continue;


		cpu_data->csd.func = zpci_handle_remote_irq;
		INIT_CSD(&cpu_data->csd, zpci_handle_remote_irq, &cpu_data->scheduled);
		cpu_data->csd.info = &cpu_data->scheduled;
		cpu_data->csd.flags = 0;
		smp_call_function_single_async(cpu, &cpu_data->csd);
		smp_call_function_single_async(cpu, &cpu_data->csd);
	}
	}
}
}
Loading