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*() ...
This commit is contained in:
@@ -45,8 +45,8 @@ MODULE_PARM_DESC(write_iteration, "# of writes between timestamp readings");
|
||||
static int producer_nice = MAX_NICE;
|
||||
static int consumer_nice = MAX_NICE;
|
||||
|
||||
static int producer_fifo = -1;
|
||||
static int consumer_fifo = -1;
|
||||
static int producer_fifo;
|
||||
static int consumer_fifo;
|
||||
|
||||
module_param(producer_nice, int, 0644);
|
||||
MODULE_PARM_DESC(producer_nice, "nice prio for producer");
|
||||
@@ -55,10 +55,10 @@ module_param(consumer_nice, int, 0644);
|
||||
MODULE_PARM_DESC(consumer_nice, "nice prio for consumer");
|
||||
|
||||
module_param(producer_fifo, int, 0644);
|
||||
MODULE_PARM_DESC(producer_fifo, "fifo prio for producer");
|
||||
MODULE_PARM_DESC(producer_fifo, "use fifo for producer: 0 - disabled, 1 - low prio, 2 - fifo");
|
||||
|
||||
module_param(consumer_fifo, int, 0644);
|
||||
MODULE_PARM_DESC(consumer_fifo, "fifo prio for consumer");
|
||||
MODULE_PARM_DESC(consumer_fifo, "use fifo for consumer: 0 - disabled, 1 - low prio, 2 - fifo");
|
||||
|
||||
static int read_events;
|
||||
|
||||
@@ -303,22 +303,22 @@ static void ring_buffer_producer(void)
|
||||
trace_printk("ERROR!\n");
|
||||
|
||||
if (!disable_reader) {
|
||||
if (consumer_fifo < 0)
|
||||
if (consumer_fifo)
|
||||
trace_printk("Running Consumer at SCHED_FIFO %s\n",
|
||||
consumer_fifo == 1 ? "low" : "high");
|
||||
else
|
||||
trace_printk("Running Consumer at nice: %d\n",
|
||||
consumer_nice);
|
||||
else
|
||||
trace_printk("Running Consumer at SCHED_FIFO %d\n",
|
||||
consumer_fifo);
|
||||
}
|
||||
if (producer_fifo < 0)
|
||||
if (producer_fifo)
|
||||
trace_printk("Running Producer at SCHED_FIFO %s\n",
|
||||
producer_fifo == 1 ? "low" : "high");
|
||||
else
|
||||
trace_printk("Running Producer at nice: %d\n",
|
||||
producer_nice);
|
||||
else
|
||||
trace_printk("Running Producer at SCHED_FIFO %d\n",
|
||||
producer_fifo);
|
||||
|
||||
/* Let the user know that the test is running at low priority */
|
||||
if (producer_fifo < 0 && consumer_fifo < 0 &&
|
||||
if (!producer_fifo && !consumer_fifo &&
|
||||
producer_nice == MAX_NICE && consumer_nice == MAX_NICE)
|
||||
trace_printk("WARNING!!! This test is running at lowest priority.\n");
|
||||
|
||||
@@ -455,21 +455,19 @@ static int __init ring_buffer_benchmark_init(void)
|
||||
* Run them as low-prio background tasks by default:
|
||||
*/
|
||||
if (!disable_reader) {
|
||||
if (consumer_fifo >= 0) {
|
||||
struct sched_param param = {
|
||||
.sched_priority = consumer_fifo
|
||||
};
|
||||
sched_setscheduler(consumer, SCHED_FIFO, ¶m);
|
||||
} else
|
||||
if (consumer_fifo >= 2)
|
||||
sched_set_fifo(consumer);
|
||||
else if (consumer_fifo == 1)
|
||||
sched_set_fifo_low(consumer);
|
||||
else
|
||||
set_user_nice(consumer, consumer_nice);
|
||||
}
|
||||
|
||||
if (producer_fifo >= 0) {
|
||||
struct sched_param param = {
|
||||
.sched_priority = producer_fifo
|
||||
};
|
||||
sched_setscheduler(producer, SCHED_FIFO, ¶m);
|
||||
} else
|
||||
if (producer_fifo >= 2)
|
||||
sched_set_fifo(producer);
|
||||
else if (producer_fifo == 1)
|
||||
sched_set_fifo_low(producer);
|
||||
else
|
||||
set_user_nice(producer, producer_nice);
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user