Skip to content

Commit 8b70098

Browse files
author
Peter Zijlstra
committed
sched: Remove sched_set_*() return value
Ingo suggested that since the new sched_set_*() functions are implemented using the 'nocheck' variants, they really shouldn't ever fail, so remove the return value. Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Suggested-by: Ingo Molnar <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Ingo Molnar <[email protected]>
1 parent 616d91b commit 8b70098

File tree

7 files changed

+16
-26
lines changed

7 files changed

+16
-26
lines changed

drivers/block/drbd/drbd_receiver.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6020,9 +6020,7 @@ int drbd_ack_receiver(struct drbd_thread *thi)
60206020
int expect = header_size;
60216021
bool ping_timeout_active = false;
60226022

6023-
rv = sched_set_fifo_low(current);
6024-
if (rv < 0)
6025-
drbd_err(connection, "drbd_ack_receiver: ERROR set priority, ret=%d\n", rv);
6023+
sched_set_fifo_low(current);
60266024

60276025
while (get_t_state(thi) == RUNNING) {
60286026
drbd_thread_current_set_cpu(thi);

drivers/firmware/psci/psci_checker.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,7 @@ static int suspend_test_thread(void *arg)
281281
wait_for_completion(&suspend_threads_started);
282282

283283
/* Set maximum priority to preempt all other threads on this CPU. */
284-
if (sched_set_fifo(current))
285-
pr_warn("Failed to set suspend thread scheduler on CPU %d\n", cpu);
284+
sched_set_fifo(current);
286285

287286
dev = this_cpu_read(cpuidle_devices);
288287
drv = cpuidle_get_cpu_driver(dev);

drivers/gpu/drm/msm/msm_drv.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,7 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
509509
goto err_msm_uninit;
510510
}
511511

512-
ret = sched_set_fifo(priv->event_thread[i].thread);
513-
if (ret)
514-
dev_warn(dev, "event_thread set priority failed:%d\n",
515-
ret);
512+
sched_set_fifo(priv->event_thread[i].thread);
516513
}
517514

518515
ret = drm_vblank_init(ddev, priv->num_crtcs);

drivers/platform/chrome/cros_ec_spi.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -725,10 +725,9 @@ static int cros_ec_spi_devm_high_pri_alloc(struct device *dev,
725725
if (err)
726726
return err;
727727

728-
err = sched_set_fifo(ec_spi->high_pri_worker->task);
729-
if (err)
730-
dev_err(dev, "Can't set cros_ec high pri priority: %d\n", err);
731-
return err;
728+
sched_set_fifo(ec_spi->high_pri_worker->task);
729+
730+
return 0;
732731
}
733732

734733
static int cros_ec_spi_probe(struct spi_device *spi)

include/linux/sched.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,9 +1653,9 @@ extern int idle_cpu(int cpu);
16531653
extern int available_idle_cpu(int cpu);
16541654
extern int sched_setscheduler(struct task_struct *, int, const struct sched_param *);
16551655
extern int sched_setscheduler_nocheck(struct task_struct *, int, const struct sched_param *);
1656-
extern int sched_set_fifo(struct task_struct *p);
1657-
extern int sched_set_fifo_low(struct task_struct *p);
1658-
extern int sched_set_normal(struct task_struct *p, int nice);
1656+
extern void sched_set_fifo(struct task_struct *p);
1657+
extern void sched_set_fifo_low(struct task_struct *p);
1658+
extern void sched_set_normal(struct task_struct *p, int nice);
16591659
extern int sched_setattr(struct task_struct *, const struct sched_attr *);
16601660
extern int sched_setattr_nocheck(struct task_struct *, const struct sched_attr *);
16611661
extern struct task_struct *idle_task(int cpu);

kernel/rcu/rcutorture.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -893,10 +893,7 @@ static int rcu_torture_boost(void *arg)
893893
VERBOSE_TOROUT_STRING("rcu_torture_boost started");
894894

895895
/* Set real-time priority. */
896-
if (sched_set_fifo_low(current) < 0) {
897-
VERBOSE_TOROUT_STRING("rcu_torture_boost RT prio failed!");
898-
n_rcu_torture_boost_rterror++;
899-
}
896+
sched_set_fifo_low(current);
900897

901898
init_rcu_head_on_stack(&rbi.rcu);
902899
/* Each pass through the following loop does one boost-test cycle. */

kernel/sched/core.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5183,30 +5183,30 @@ int sched_setscheduler_nocheck(struct task_struct *p, int policy,
51835183
* The administrator _MUST_ configure the system, the kernel simply doesn't
51845184
* know enough information to make a sensible choice.
51855185
*/
5186-
int sched_set_fifo(struct task_struct *p)
5186+
void sched_set_fifo(struct task_struct *p)
51875187
{
51885188
struct sched_param sp = { .sched_priority = MAX_RT_PRIO / 2 };
5189-
return sched_setscheduler_nocheck(p, SCHED_FIFO, &sp);
5189+
WARN_ON_ONCE(sched_setscheduler_nocheck(p, SCHED_FIFO, &sp) != 0);
51905190
}
51915191
EXPORT_SYMBOL_GPL(sched_set_fifo);
51925192

51935193
/*
51945194
* For when you don't much care about FIFO, but want to be above SCHED_NORMAL.
51955195
*/
5196-
int sched_set_fifo_low(struct task_struct *p)
5196+
void sched_set_fifo_low(struct task_struct *p)
51975197
{
51985198
struct sched_param sp = { .sched_priority = 1 };
5199-
return sched_setscheduler_nocheck(p, SCHED_FIFO, &sp);
5199+
WARN_ON_ONCE(sched_setscheduler_nocheck(p, SCHED_FIFO, &sp) != 0);
52005200
}
52015201
EXPORT_SYMBOL_GPL(sched_set_fifo_low);
52025202

5203-
int sched_set_normal(struct task_struct *p, int nice)
5203+
void sched_set_normal(struct task_struct *p, int nice)
52045204
{
52055205
struct sched_attr attr = {
52065206
.sched_policy = SCHED_NORMAL,
52075207
.sched_nice = nice,
52085208
};
5209-
return sched_setattr_nocheck(p, &attr);
5209+
WARN_ON_ONCE(sched_setattr_nocheck(p, &attr) != 0);
52105210
}
52115211
EXPORT_SYMBOL_GPL(sched_set_normal);
52125212

0 commit comments

Comments
 (0)