diff options
| -rw-r--r-- | Documentation/kernel-parameters.txt | 9 | ||||
| -rw-r--r-- | kernel/time/tick-sched.c | 18 |
2 files changed, 27 insertions, 0 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index b69cfdc12112..ea38cd1f0aba 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -2532,6 +2532,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
| 2532 | 2532 | ||
| 2533 | sched_debug [KNL] Enables verbose scheduler debug messages. | 2533 | sched_debug [KNL] Enables verbose scheduler debug messages. |
| 2534 | 2534 | ||
| 2535 | skew_tick= [KNL] Offset the periodic timer tick per cpu to mitigate | ||
| 2536 | xtime_lock contention on larger systems, and/or RCU lock | ||
| 2537 | contention on all systems with CONFIG_MAXSMP set. | ||
| 2538 | Format: { "0" | "1" } | ||
| 2539 | 0 -- disable. (may be 1 via CONFIG_CMDLINE="skew_tick=1" | ||
| 2540 | 1 -- enable. | ||
| 2541 | Note: increases power consumption, thus should only be | ||
| 2542 | enabled if running jitter sensitive (HPC/RT) workloads. | ||
| 2543 | |||
| 2535 | security= [SECURITY] Choose a security module to enable at boot. | 2544 | security= [SECURITY] Choose a security module to enable at boot. |
| 2536 | If this boot parameter is not specified, only the first | 2545 | If this boot parameter is not specified, only the first |
| 2537 | security module asking for security registration will be | 2546 | security module asking for security registration will be |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 6a3a5b9ff561..4eddbb5ea9c5 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
| @@ -814,6 +814,8 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer) | |||
| 814 | return HRTIMER_RESTART; | 814 | return HRTIMER_RESTART; |
| 815 | } | 815 | } |
| 816 | 816 | ||
| 817 | static int sched_skew_tick; | ||
| 818 | |||
| 817 | /** | 819 | /** |
| 818 | * tick_setup_sched_timer - setup the tick emulation timer | 820 | * tick_setup_sched_timer - setup the tick emulation timer |
| 819 | */ | 821 | */ |
| @@ -831,6 +833,14 @@ void tick_setup_sched_timer(void) | |||
| 831 | /* Get the next period (per cpu) */ | 833 | /* Get the next period (per cpu) */ |
| 832 | hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update()); | 834 | hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update()); |
| 833 | 835 | ||
| 836 | /* Offset the tick to avert xtime_lock contention. */ | ||
| 837 | if (sched_skew_tick) { | ||
| 838 | u64 offset = ktime_to_ns(tick_period) >> 1; | ||
| 839 | do_div(offset, num_possible_cpus()); | ||
| 840 | offset *= smp_processor_id(); | ||
| 841 | hrtimer_add_expires_ns(&ts->sched_timer, offset); | ||
| 842 | } | ||
| 843 | |||
| 834 | for (;;) { | 844 | for (;;) { |
| 835 | hrtimer_forward(&ts->sched_timer, now, tick_period); | 845 | hrtimer_forward(&ts->sched_timer, now, tick_period); |
| 836 | hrtimer_start_expires(&ts->sched_timer, | 846 | hrtimer_start_expires(&ts->sched_timer, |
| @@ -910,3 +920,11 @@ int tick_check_oneshot_change(int allow_nohz) | |||
| 910 | tick_nohz_switch_to_nohz(); | 920 | tick_nohz_switch_to_nohz(); |
| 911 | return 0; | 921 | return 0; |
| 912 | } | 922 | } |
| 923 | |||
| 924 | static int __init skew_tick(char *str) | ||
| 925 | { | ||
| 926 | get_option(&str, &sched_skew_tick); | ||
| 927 | |||
| 928 | return 0; | ||
| 929 | } | ||
| 930 | early_param("skew_tick", skew_tick); | ||
