Commit 6d2b84a4 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'sched-fifo-2020-08-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull sched/fifo updates from Ingo Molnar:
 "This adds the sched_set_fifo*() encapsulation APIs to remove static
  priority level knowledge from non-scheduler code.

  The three APIs for non-scheduler code to set SCHED_FIFO are:

   - sched_set_fifo()
   - sched_set_fifo_low()
   - sched_set_normal()

  These are two FIFO priority levels: default (high), and a 'low'
  priority level, plus sched_set_normal() to set the policy back to
  non-SCHED_FIFO.

  Since the changes affect a lot of non-scheduler code, we kept this in
  a separate tree"

* tag 'sched-fifo-2020-08-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
  sched,tracing: Convert to sched_set_fifo()
  sched: Remove sched_set_*() return value
  sched: Remove sched_setscheduler*() EXPORTs
  sched,psi: Convert to sched_set_fifo_low()
  sched,rcutorture: Convert to sched_set_fifo_low()
  sched,rcuperf: Convert to sched_set_fifo_low()
  sched,locktorture: Convert to sched_set_fifo()
  sched,irq: Convert to sched_set_fifo()
  sched,watchdog: Convert to sched_set_fifo()
  sched,serial: Convert to sched_set_fifo()
  sched,powerclamp: Convert to sched_set_fifo()
  sched,ion: Convert to sched_set_normal()
  sched,powercap: Convert to sched_set_fifo*()
  sched,spi: Convert to sched_set_fifo*()
  sched,mmc: Convert to sched_set_fifo*()
  sched,ivtv: Convert to sched_set_fifo*()
  sched,drm/scheduler: Convert to sched_set_fifo*()
  sched,msm: Convert to sched_set_fifo*()
  sched,psci: Convert to sched_set_fifo*()
  sched,drbd: Convert to sched_set_fifo*()
  ...
parents 4cec9293 4fd5750a
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -270,12 +270,11 @@ static struct bL_thread bL_threads[NR_CPUS];
static int bL_switcher_thread(void *arg)
static int bL_switcher_thread(void *arg)
{
{
	struct bL_thread *t = arg;
	struct bL_thread *t = arg;
	struct sched_param param = { .sched_priority = 1 };
	int cluster;
	int cluster;
	bL_switch_completion_handler completer;
	bL_switch_completion_handler completer;
	void *completer_cookie;
	void *completer_cookie;


	sched_setscheduler_nocheck(current, SCHED_FIFO, &param);
	sched_set_fifo_low(current);
	complete(&t->started);
	complete(&t->started);


	do {
	do {
+1 −2
Original line number Original line Diff line number Diff line
@@ -482,7 +482,6 @@ struct crypto_engine *crypto_engine_alloc_init_and_set(struct device *dev,
						       int (*cbk_do_batch)(struct crypto_engine *engine),
						       int (*cbk_do_batch)(struct crypto_engine *engine),
						       bool rt, int qlen)
						       bool rt, int qlen)
{
{
	struct sched_param param = { .sched_priority = MAX_RT_PRIO / 2 };
	struct crypto_engine *engine;
	struct crypto_engine *engine;


	if (!dev)
	if (!dev)
@@ -520,7 +519,7 @@ struct crypto_engine *crypto_engine_alloc_init_and_set(struct device *dev,


	if (engine->rt) {
	if (engine->rt) {
		dev_info(dev, "will run requests pump with realtime priority\n");
		dev_info(dev, "will run requests pump with realtime priority\n");
		sched_setscheduler(engine->kworker->task, SCHED_FIFO, &param);
		sched_set_fifo(engine->kworker->task);
	}
	}


	return engine;
	return engine;
+1 −2
Original line number Original line Diff line number Diff line
@@ -136,12 +136,11 @@ static unsigned int idle_pct = 5; /* percentage */
static unsigned int round_robin_time = 1; /* second */
static unsigned int round_robin_time = 1; /* second */
static int power_saving_thread(void *data)
static int power_saving_thread(void *data)
{
{
	struct sched_param param = {.sched_priority = 1};
	int do_sleep;
	int do_sleep;
	unsigned int tsk_index = (unsigned long)data;
	unsigned int tsk_index = (unsigned long)data;
	u64 last_jiffies = 0;
	u64 last_jiffies = 0;


	sched_setscheduler(current, SCHED_RR, &param);
	sched_set_fifo_low(current);


	while (!kthread_should_stop()) {
	while (!kthread_should_stop()) {
		unsigned long expire_time;
		unsigned long expire_time;
+1 −4
Original line number Original line Diff line number Diff line
@@ -6019,11 +6019,8 @@ int drbd_ack_receiver(struct drbd_thread *thi)
	unsigned int header_size = drbd_header_size(connection);
	unsigned int header_size = drbd_header_size(connection);
	int expect   = header_size;
	int expect   = header_size;
	bool ping_timeout_active = false;
	bool ping_timeout_active = false;
	struct sched_param param = { .sched_priority = 2 };


	rv = sched_setscheduler(current, SCHED_RR, &param);
	sched_set_fifo_low(current);
	if (rv < 0)
		drbd_err(connection, "drbd_ack_receiver: ERROR set priority, ret=%d\n", rv);


	while (get_t_state(thi) == RUNNING) {
	while (get_t_state(thi) == RUNNING) {
		drbd_thread_current_set_cpu(thi);
		drbd_thread_current_set_cpu(thi);
+1 −9
Original line number Original line Diff line number Diff line
@@ -274,7 +274,6 @@ static int suspend_test_thread(void *arg)
{
{
	int cpu = (long)arg;
	int cpu = (long)arg;
	int i, nb_suspend = 0, nb_shallow_sleep = 0, nb_err = 0;
	int i, nb_suspend = 0, nb_shallow_sleep = 0, nb_err = 0;
	struct sched_param sched_priority = { .sched_priority = MAX_RT_PRIO-1 };
	struct cpuidle_device *dev;
	struct cpuidle_device *dev;
	struct cpuidle_driver *drv;
	struct cpuidle_driver *drv;
	/* No need for an actual callback, we just want to wake up the CPU. */
	/* No need for an actual callback, we just want to wake up the CPU. */
@@ -284,9 +283,7 @@ static int suspend_test_thread(void *arg)
	wait_for_completion(&suspend_threads_started);
	wait_for_completion(&suspend_threads_started);


	/* Set maximum priority to preempt all other threads on this CPU. */
	/* Set maximum priority to preempt all other threads on this CPU. */
	if (sched_setscheduler_nocheck(current, SCHED_FIFO, &sched_priority))
	sched_set_fifo(current);
		pr_warn("Failed to set suspend thread scheduler on CPU %d\n",
			cpu);


	dev = this_cpu_read(cpuidle_devices);
	dev = this_cpu_read(cpuidle_devices);
	drv = cpuidle_get_cpu_driver(dev);
	drv = cpuidle_get_cpu_driver(dev);
@@ -351,11 +348,6 @@ static int suspend_test_thread(void *arg)
	if (atomic_dec_return_relaxed(&nb_active_threads) == 0)
	if (atomic_dec_return_relaxed(&nb_active_threads) == 0)
		complete(&suspend_threads_done);
		complete(&suspend_threads_done);


	/* Give up on RT scheduling and wait for termination. */
	sched_priority.sched_priority = 0;
	if (sched_setscheduler_nocheck(current, SCHED_NORMAL, &sched_priority))
		pr_warn("Failed to set suspend thread scheduler on CPU %d\n",
			cpu);
	for (;;) {
	for (;;) {
		/* Needs to be set first to avoid missing a wakeup. */
		/* Needs to be set first to avoid missing a wakeup. */
		set_current_state(TASK_INTERRUPTIBLE);
		set_current_state(TASK_INTERRUPTIBLE);
Loading