| .. | .. |
|---|
| 75 | 75 | loads[1] = (avenrun[1] + offset) << shift; |
|---|
| 76 | 76 | loads[2] = (avenrun[2] + offset) << shift; |
|---|
| 77 | 77 | } |
|---|
| 78 | +EXPORT_SYMBOL_GPL(get_avenrun); |
|---|
| 78 | 79 | |
|---|
| 79 | 80 | long calc_load_fold_active(struct rq *this_rq, long adjust) |
|---|
| 80 | 81 | { |
|---|
| .. | .. |
|---|
| 231 | 232 | return calc_load_idx & 1; |
|---|
| 232 | 233 | } |
|---|
| 233 | 234 | |
|---|
| 234 | | -void calc_load_nohz_start(void) |
|---|
| 235 | +static void calc_load_nohz_fold(struct rq *rq) |
|---|
| 235 | 236 | { |
|---|
| 236 | | - struct rq *this_rq = this_rq(); |
|---|
| 237 | 237 | long delta; |
|---|
| 238 | 238 | |
|---|
| 239 | | - /* |
|---|
| 240 | | - * We're going into NO_HZ mode, if there's any pending delta, fold it |
|---|
| 241 | | - * into the pending NO_HZ delta. |
|---|
| 242 | | - */ |
|---|
| 243 | | - delta = calc_load_fold_active(this_rq, 0); |
|---|
| 239 | + delta = calc_load_fold_active(rq, 0); |
|---|
| 244 | 240 | if (delta) { |
|---|
| 245 | 241 | int idx = calc_load_write_idx(); |
|---|
| 246 | 242 | |
|---|
| 247 | 243 | atomic_long_add(delta, &calc_load_nohz[idx]); |
|---|
| 248 | 244 | } |
|---|
| 245 | +} |
|---|
| 246 | + |
|---|
| 247 | +void calc_load_nohz_start(void) |
|---|
| 248 | +{ |
|---|
| 249 | + /* |
|---|
| 250 | + * We're going into NO_HZ mode, if there's any pending delta, fold it |
|---|
| 251 | + * into the pending NO_HZ delta. |
|---|
| 252 | + */ |
|---|
| 253 | + calc_load_nohz_fold(this_rq()); |
|---|
| 254 | +} |
|---|
| 255 | + |
|---|
| 256 | +/* |
|---|
| 257 | + * Keep track of the load for NOHZ_FULL, must be called between |
|---|
| 258 | + * calc_load_nohz_{start,stop}(). |
|---|
| 259 | + */ |
|---|
| 260 | +void calc_load_nohz_remote(struct rq *rq) |
|---|
| 261 | +{ |
|---|
| 262 | + calc_load_nohz_fold(rq); |
|---|
| 249 | 263 | } |
|---|
| 250 | 264 | |
|---|
| 251 | 265 | void calc_load_nohz_stop(void) |
|---|
| .. | .. |
|---|
| 268 | 282 | this_rq->calc_load_update += LOAD_FREQ; |
|---|
| 269 | 283 | } |
|---|
| 270 | 284 | |
|---|
| 271 | | -static long calc_load_nohz_fold(void) |
|---|
| 285 | +static long calc_load_nohz_read(void) |
|---|
| 272 | 286 | { |
|---|
| 273 | 287 | int idx = calc_load_read_idx(); |
|---|
| 274 | 288 | long delta = 0; |
|---|
| .. | .. |
|---|
| 323 | 337 | } |
|---|
| 324 | 338 | #else /* !CONFIG_NO_HZ_COMMON */ |
|---|
| 325 | 339 | |
|---|
| 326 | | -static inline long calc_load_nohz_fold(void) { return 0; } |
|---|
| 340 | +static inline long calc_load_nohz_read(void) { return 0; } |
|---|
| 327 | 341 | static inline void calc_global_nohz(void) { } |
|---|
| 328 | 342 | |
|---|
| 329 | 343 | #endif /* CONFIG_NO_HZ_COMMON */ |
|---|
| .. | .. |
|---|
| 334 | 348 | * |
|---|
| 335 | 349 | * Called from the global timer code. |
|---|
| 336 | 350 | */ |
|---|
| 337 | | -void calc_global_load(unsigned long ticks) |
|---|
| 351 | +void calc_global_load(void) |
|---|
| 338 | 352 | { |
|---|
| 339 | 353 | unsigned long sample_window; |
|---|
| 340 | 354 | long active, delta; |
|---|
| .. | .. |
|---|
| 346 | 360 | /* |
|---|
| 347 | 361 | * Fold the 'old' NO_HZ-delta to include all NO_HZ CPUs. |
|---|
| 348 | 362 | */ |
|---|
| 349 | | - delta = calc_load_nohz_fold(); |
|---|
| 363 | + delta = calc_load_nohz_read(); |
|---|
| 350 | 364 | if (delta) |
|---|
| 351 | 365 | atomic_long_add(delta, &calc_load_tasks); |
|---|
| 352 | 366 | |
|---|