Skip to content

Commit 6d2b84a

Browse files
committed
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*() ...
2 parents 4cec929 + 4fd5750 commit 6d2b84a

File tree

25 files changed

+100
-124
lines changed

25 files changed

+100
-124
lines changed

arch/arm/common/bL_switcher.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,11 @@ static struct bL_thread bL_threads[NR_CPUS];
270270
static int bL_switcher_thread(void *arg)
271271
{
272272
struct bL_thread *t = arg;
273-
struct sched_param param = { .sched_priority = 1 };
274273
int cluster;
275274
bL_switch_completion_handler completer;
276275
void *completer_cookie;
277276

278-
sched_setscheduler_nocheck(current, SCHED_FIFO, &param);
277+
sched_set_fifo_low(current);
279278
complete(&t->started);
280279

281280
do {

crypto/crypto_engine.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ struct crypto_engine *crypto_engine_alloc_init_and_set(struct device *dev,
482482
int (*cbk_do_batch)(struct crypto_engine *engine),
483483
bool rt, int qlen)
484484
{
485-
struct sched_param param = { .sched_priority = MAX_RT_PRIO / 2 };
486485
struct crypto_engine *engine;
487486

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

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

526525
return engine;

drivers/acpi/acpi_pad.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,11 @@ static unsigned int idle_pct = 5; /* percentage */
136136
static unsigned int round_robin_time = 1; /* second */
137137
static int power_saving_thread(void *data)
138138
{
139-
struct sched_param param = {.sched_priority = 1};
140139
int do_sleep;
141140
unsigned int tsk_index = (unsigned long)data;
142141
u64 last_jiffies = 0;
143142

144-
sched_setscheduler(current, SCHED_RR, &param);
143+
sched_set_fifo_low(current);
145144

146145
while (!kthread_should_stop()) {
147146
unsigned long expire_time;

drivers/block/drbd/drbd_receiver.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6019,11 +6019,8 @@ int drbd_ack_receiver(struct drbd_thread *thi)
60196019
unsigned int header_size = drbd_header_size(connection);
60206020
int expect = header_size;
60216021
bool ping_timeout_active = false;
6022-
struct sched_param param = { .sched_priority = 2 };
60236022

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

60286025
while (get_t_state(thi) == RUNNING) {
60296026
drbd_thread_current_set_cpu(thi);

drivers/firmware/psci/psci_checker.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ static int suspend_test_thread(void *arg)
274274
{
275275
int cpu = (long)arg;
276276
int i, nb_suspend = 0, nb_shallow_sleep = 0, nb_err = 0;
277-
struct sched_param sched_priority = { .sched_priority = MAX_RT_PRIO-1 };
278277
struct cpuidle_device *dev;
279278
struct cpuidle_driver *drv;
280279
/* 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)
284283
wait_for_completion(&suspend_threads_started);
285284

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

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

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

drivers/gpu/drm/drm_vblank_work.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,6 @@ EXPORT_SYMBOL(drm_vblank_work_init);
248248

249249
int drm_vblank_worker_init(struct drm_vblank_crtc *vblank)
250250
{
251-
struct sched_param param = {
252-
.sched_priority = MAX_RT_PRIO - 1,
253-
};
254251
struct kthread_worker *worker;
255252

256253
INIT_LIST_HEAD(&vblank->pending_work);
@@ -263,5 +260,6 @@ int drm_vblank_worker_init(struct drm_vblank_crtc *vblank)
263260

264261
vblank->worker = worker;
265262

266-
return sched_setscheduler(vblank->worker->task, SCHED_FIFO, &param);
263+
sched_set_fifo(worker->task);
264+
return 0;
267265
}

drivers/gpu/drm/msm/msm_drv.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
401401
struct msm_kms *kms;
402402
struct msm_mdss *mdss;
403403
int ret, i;
404-
struct sched_param param;
405404

406405
ddev = drm_dev_alloc(drv, dev);
407406
if (IS_ERR(ddev)) {
@@ -507,12 +506,6 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
507506
ddev->mode_config.funcs = &mode_config_funcs;
508507
ddev->mode_config.helper_private = &mode_config_helper_funcs;
509508

510-
/**
511-
* this priority was found during empiric testing to have appropriate
512-
* realtime scheduling to process display updates and interact with
513-
* other real time and normal priority task
514-
*/
515-
param.sched_priority = 16;
516509
for (i = 0; i < priv->num_crtcs; i++) {
517510
/* initialize event thread */
518511
priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id;
@@ -524,11 +517,7 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
524517
goto err_msm_uninit;
525518
}
526519

527-
ret = sched_setscheduler(priv->event_thread[i].worker->task,
528-
SCHED_FIFO, &param);
529-
if (ret)
530-
dev_warn(dev, "event_thread set priority failed:%d\n",
531-
ret);
520+
sched_set_fifo(priv->event_thread[i].worker->task);
532521
}
533522

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

drivers/gpu/drm/scheduler/sched_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,11 +762,10 @@ static bool drm_sched_blocked(struct drm_gpu_scheduler *sched)
762762
*/
763763
static int drm_sched_main(void *param)
764764
{
765-
struct sched_param sparam = {.sched_priority = 1};
766765
struct drm_gpu_scheduler *sched = (struct drm_gpu_scheduler *)param;
767766
int r;
768767

769-
sched_setscheduler(current, SCHED_FIFO, &sparam);
768+
sched_set_fifo_low(current);
770769

771770
while (!kthread_should_stop()) {
772771
struct drm_sched_entity *entity = NULL;

drivers/media/pci/ivtv/ivtv-driver.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,6 @@ static void ivtv_process_options(struct ivtv *itv)
737737
*/
738738
static int ivtv_init_struct1(struct ivtv *itv)
739739
{
740-
struct sched_param param = { .sched_priority = 99 };
741-
742740
itv->base_addr = pci_resource_start(itv->pdev, 0);
743741
itv->enc_mbox.max_mbox = 2; /* the encoder has 3 mailboxes (0-2) */
744742
itv->dec_mbox.max_mbox = 1; /* the decoder has 2 mailboxes (0-1) */
@@ -758,7 +756,7 @@ static int ivtv_init_struct1(struct ivtv *itv)
758756
return -1;
759757
}
760758
/* must use the FIFO scheduler as it is realtime sensitive */
761-
sched_setscheduler(itv->irq_worker_task, SCHED_FIFO, &param);
759+
sched_set_fifo(itv->irq_worker_task);
762760

763761
kthread_init_work(&itv->irq_work, ivtv_irq_work_handler);
764762

drivers/mmc/core/sdio_irq.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,10 @@ EXPORT_SYMBOL_GPL(sdio_signal_irq);
139139
static int sdio_irq_thread(void *_host)
140140
{
141141
struct mmc_host *host = _host;
142-
struct sched_param param = { .sched_priority = 1 };
143142
unsigned long period, idle_period;
144143
int ret;
145144

146-
sched_setscheduler(current, SCHED_FIFO, &param);
145+
sched_set_fifo_low(current);
147146

148147
/*
149148
* We want to allow for SDIO cards to work even on non SDIO

0 commit comments

Comments
 (0)