calc_load_global() does not need the sequence count protection. [ tglx: Split it up properly and added comments ]
Unified · Split
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | #include <linux/sched/clock.h> | 20 | #include <linux/sched/clock.h> |
| 21 | #include <linux/sched/stat.h> | 21 | #include <linux/sched/stat.h> |
| 22 | #include <linux/sched/nohz.h> | 22 | #include <linux/sched/nohz.h> |
| 23 | #include <linux/sched/loadavg.h> | ||
| 23 | #include <linux/module.h> | 24 | #include <linux/module.h> |
| 24 | #include <linux/irq_work.h> | 25 | #include <linux/irq_work.h> |
| 25 | #include <linux/posix-timers.h> | 26 | #include <linux/posix-timers.h> |
| @@ -107,7 +108,8 @@ static void tick_do_update_jiffies64(ktime_t now) · 81 unmodified lines | |||
| 107 | tick_period); | 108 | tick_period); |
| 108 | } | 109 | } |
| 109 | 110 | ||
| 110 | do_timer(ticks); | 111 | /* Advance jiffies to complete the jiffies_seq protected job */ |
| 112 | jiffies_64 += ticks; | ||
| 111 | 113 | ||
| 112 | /* | 114 | /* |
| 113 | * Keep the tick_next_period variable up to date. WRITE_ONCE() | 115 | * Keep the tick_next_period variable up to date. WRITE_ONCE() |
| @@ -116,7 +118,15 @@ static void tick_do_update_jiffies64(ktime_t now) · 2 unmodified lines | |||
| 116 | WRITE_ONCE(tick_next_period, | 118 | WRITE_ONCE(tick_next_period, |
| 117 | ktime_add(last_jiffies_update, tick_period)); | 119 | ktime_add(last_jiffies_update, tick_period)); |
| 118 | 120 | ||
| 121 | /* | ||
| 122 | * Release the sequence count. calc_global_load() below is not | ||
| 123 | * protected by it, but jiffies_lock needs to be held to prevent | ||
| 124 | * concurrent invocations. | ||
| 125 | */ | ||
| 119 | write_seqcount_end(&jiffies_seq); | 126 | write_seqcount_end(&jiffies_seq); |
| 127 | |||
| 128 | calc_global_load(); | ||
| 129 | |||
| 120 | raw_spin_unlock(&jiffies_lock); | 130 | raw_spin_unlock(&jiffies_lock); |
| 121 | update_wall_time(); | 131 | update_wall_time(); |
| 122 | } | 132 | } |