Commit 3bd012060f962567aadb52b27b2fc8fdc91102c7

Authored by Arjan van de Ven
1 parent 96d2ab484e

hrtimer: make the nanosleep() syscall use the per process slack

This patch makes the nanosleep() system call use the per process
slack value; with this users are able to externally control existing
applications to reduce the wakeup rate.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>

Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff

... ... @@ -1563,9 +1563,14 @@
1563 1563 struct restart_block *restart;
1564 1564 struct hrtimer_sleeper t;
1565 1565 int ret = 0;
  1566 + unsigned long slack;
1566 1567  
  1568 + slack = current->timer_slack_ns;
  1569 + if (rt_task(current))
  1570 + slack = 0;
  1571 +
1567 1572 hrtimer_init_on_stack(&t.timer, clockid, mode);
1568   - hrtimer_set_expires(&t.timer, timespec_to_ktime(*rqtp));
  1573 + hrtimer_set_expires_range_ns(&t.timer, timespec_to_ktime(*rqtp), slack);
1569 1574 if (do_nanosleep(&t, mode))
1570 1575 goto out;
1571 1576