History

sched,locktorture: Convert to sched_set_fifo()

Because SCHED_FIFO is a broken scheduler model (see previous patches) take away the priority field, the kernel can't possibly make an informed decision. Effectively changes prio from 99 to 50.

Peter Zijlstra committed 6 years ago

Commit 93db9121 parent 7a407981 file · +2 −8Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/locking/locktorture.c+2−8
@@ -436,8 +436,6 @@ static int torture_rtmutex_lock(void) __acquires(torture_rtmutex) · 435 unmodified lines
436 436
437static void torture_rtmutex_boost(struct torture_random_state *trsp)437static void torture_rtmutex_boost(struct torture_random_state *trsp)
438{438{
439 int policy;
440 struct sched_param param;
441 const unsigned int factor = 50000; /* yes, quite arbitrary */439 const unsigned int factor = 50000; /* yes, quite arbitrary */
442 440
443 if (!rt_task(current)) {441 if (!rt_task(current)) {
@@ -448,8 +446,7 @@ static void torture_rtmutex_boost(struct torture_random_state *trsp) · 4 unmodified lines
448 */446 */
449 if (trsp && !(torture_random(trsp) %447 if (trsp && !(torture_random(trsp) %
450 (cxt.nrealwriters_stress * factor))) {448 (cxt.nrealwriters_stress * factor))) {
451 policy = SCHED_FIFO;449 sched_set_fifo(current);
452 param.sched_priority = MAX_RT_PRIO - 1;
453 } else /* common case, do nothing */450 } else /* common case, do nothing */
454 return;451 return;
455 } else {452 } else {
@@ -462,13 +459,10 @@ static void torture_rtmutex_boost(struct torture_random_state *trsp) · 6 unmodified lines
462 */459 */
463 if (!trsp || !(torture_random(trsp) %460 if (!trsp || !(torture_random(trsp) %
464 (cxt.nrealwriters_stress * factor * 2))) {461 (cxt.nrealwriters_stress * factor * 2))) {
465 policy = SCHED_NORMAL;462 sched_set_normal(current, 0);
466 param.sched_priority = 0;
467 } else /* common case, do nothing */463 } else /* common case, do nothing */
468 return;464 return;
469 }465 }
470
471 sched_setscheduler_nocheck(current, policy, &param);
472}466}
473 467
474static void torture_rtmutex_delay(struct torture_random_state *trsp)468static void torture_rtmutex_delay(struct torture_random_state *trsp)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t