diff options
| author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-02-22 17:04:41 -0500 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-02-22 17:04:41 -0500 |
| commit | 61b80086a525c8a6081257ae40da5dee2bcaee16 (patch) | |
| tree | 675da35e4c03be3a5ca17bf6430e5b51dfed6296 /kernel | |
| parent | a5f17d1f4c2831b9b9bf8b1a537cdbac995d6e13 (diff) | |
| parent | 230f984662d7e0e4a9597c665fd4f53130666e7d (diff) | |
Merge branch 'entry-macro-cleanup' of git://sources.calxeda.com/kernel/linux into for-armsoc
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/events/core.c | 104 | ||||
| -rw-r--r-- | kernel/exit.c | 16 | ||||
| -rw-r--r-- | kernel/fork.c | 20 | ||||
| -rw-r--r-- | kernel/kprobes.c | 6 | ||||
| -rw-r--r-- | kernel/power/power.h | 24 | ||||
| -rw-r--r-- | kernel/power/process.c | 7 | ||||
| -rw-r--r-- | kernel/power/user.c | 6 | ||||
| -rw-r--r-- | kernel/sched/core.c | 19 | ||||
| -rw-r--r-- | kernel/sched/fair.c | 34 | ||||
| -rw-r--r-- | kernel/sched/rt.c | 5 | ||||
| -rw-r--r-- | kernel/watchdog.c | 2 |
11 files changed, 180 insertions, 63 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 32b48c889711..ba36013cfb21 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
| @@ -2300,6 +2300,9 @@ do { \ | |||
| 2300 | return div64_u64(dividend, divisor); | 2300 | return div64_u64(dividend, divisor); |
| 2301 | } | 2301 | } |
| 2302 | 2302 | ||
| 2303 | static DEFINE_PER_CPU(int, perf_throttled_count); | ||
| 2304 | static DEFINE_PER_CPU(u64, perf_throttled_seq); | ||
| 2305 | |||
| 2303 | static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) | 2306 | static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) |
| 2304 | { | 2307 | { |
| 2305 | struct hw_perf_event *hwc = &event->hw; | 2308 | struct hw_perf_event *hwc = &event->hw; |
| @@ -2325,16 +2328,29 @@ static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) | |||
| 2325 | } | 2328 | } |
| 2326 | } | 2329 | } |
| 2327 | 2330 | ||
| 2328 | static void perf_ctx_adjust_freq(struct perf_event_context *ctx, u64 period) | 2331 | /* |
| 2332 | * combine freq adjustment with unthrottling to avoid two passes over the | ||
| 2333 | * events. At the same time, make sure, having freq events does not change | ||
| 2334 | * the rate of unthrottling as that would introduce bias. | ||
| 2335 | */ | ||
| 2336 | static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, | ||
| 2337 | int needs_unthr) | ||
| 2329 | { | 2338 | { |
| 2330 | struct perf_event *event; | 2339 | struct perf_event *event; |
| 2331 | struct hw_perf_event *hwc; | 2340 | struct hw_perf_event *hwc; |
| 2332 | u64 interrupts, now; | 2341 | u64 now, period = TICK_NSEC; |
| 2333 | s64 delta; | 2342 | s64 delta; |
| 2334 | 2343 | ||
| 2335 | if (!ctx->nr_freq) | 2344 | /* |
| 2345 | * only need to iterate over all events iff: | ||
| 2346 | * - context have events in frequency mode (needs freq adjust) | ||
| 2347 | * - there are events to unthrottle on this cpu | ||
| 2348 | */ | ||
| 2349 | if (!(ctx->nr_freq || needs_unthr)) | ||
| 2336 | return; | 2350 | return; |
| 2337 | 2351 | ||
| 2352 | raw_spin_lock(&ctx->lock); | ||
| 2353 | |||
| 2338 | list_for_each_entry_rcu(event, &ctx->event_list, event_entry) { | 2354 | list_for_each_entry_rcu(event, &ctx->event_list, event_entry) { |
| 2339 | if (event->state != PERF_EVENT_STATE_ACTIVE) | 2355 | if (event->state != PERF_EVENT_STATE_ACTIVE) |
| 2340 | continue; | 2356 | continue; |
| @@ -2344,13 +2360,8 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx, u64 period) | |||
| 2344 | 2360 | ||
| 2345 | hwc = &event->hw; | 2361 | hwc = &event->hw; |
| 2346 | 2362 | ||
| 2347 | interrupts = hwc->interrupts; | 2363 | if (needs_unthr && hwc->interrupts == MAX_INTERRUPTS) { |
| 2348 | hwc->interrupts = 0; | 2364 | hwc->interrupts = 0; |
| 2349 | |||
| 2350 | /* | ||
| 2351 | * unthrottle events on the tick | ||
| 2352 | */ | ||
| 2353 | if (interrupts == MAX_INTERRUPTS) { | ||
| 2354 | perf_log_throttle(event, 1); | 2365 | perf_log_throttle(event, 1); |
| 2355 | event->pmu->start(event, 0); | 2366 | event->pmu->start(event, 0); |
| 2356 | } | 2367 | } |
| @@ -2358,14 +2369,26 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx, u64 period) | |||
| 2358 | if (!event->attr.freq || !event->attr.sample_freq) | 2369 | if (!event->attr.freq || !event->attr.sample_freq) |
| 2359 | continue; | 2370 | continue; |
| 2360 | 2371 | ||
| 2361 | event->pmu->read(event); | 2372 | /* |
| 2373 | * stop the event and update event->count | ||
| 2374 | */ | ||
| 2375 | event->pmu->stop(event, PERF_EF_UPDATE); | ||
| 2376 | |||
| 2362 | now = local64_read(&event->count); | 2377 | now = local64_read(&event->count); |
| 2363 | delta = now - hwc->freq_count_stamp; | 2378 | delta = now - hwc->freq_count_stamp; |
| 2364 | hwc->freq_count_stamp = now; | 2379 | hwc->freq_count_stamp = now; |
| 2365 | 2380 | ||
| 2381 | /* | ||
| 2382 | * restart the event | ||
| 2383 | * reload only if value has changed | ||
| 2384 | */ | ||
| 2366 | if (delta > 0) | 2385 | if (delta > 0) |
| 2367 | perf_adjust_period(event, period, delta); | 2386 | perf_adjust_period(event, period, delta); |
| 2387 | |||
| 2388 | event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0); | ||
| 2368 | } | 2389 | } |
| 2390 | |||
| 2391 | raw_spin_unlock(&ctx->lock); | ||
| 2369 | } | 2392 | } |
| 2370 | 2393 | ||
| 2371 | /* | 2394 | /* |
| @@ -2388,16 +2411,13 @@ static void rotate_ctx(struct perf_event_context *ctx) | |||
| 2388 | */ | 2411 | */ |
| 2389 | static void perf_rotate_context(struct perf_cpu_context *cpuctx) | 2412 | static void perf_rotate_context(struct perf_cpu_context *cpuctx) |
| 2390 | { | 2413 | { |
| 2391 | u64 interval = (u64)cpuctx->jiffies_interval * TICK_NSEC; | ||
| 2392 | struct perf_event_context *ctx = NULL; | 2414 | struct perf_event_context *ctx = NULL; |
| 2393 | int rotate = 0, remove = 1, freq = 0; | 2415 | int rotate = 0, remove = 1; |
| 2394 | 2416 | ||
| 2395 | if (cpuctx->ctx.nr_events) { | 2417 | if (cpuctx->ctx.nr_events) { |
| 2396 | remove = 0; | 2418 | remove = 0; |
| 2397 | if (cpuctx->ctx.nr_events != cpuctx->ctx.nr_active) | 2419 | if (cpuctx->ctx.nr_events != cpuctx->ctx.nr_active) |
| 2398 | rotate = 1; | 2420 | rotate = 1; |
| 2399 | if (cpuctx->ctx.nr_freq) | ||
| 2400 | freq = 1; | ||
| 2401 | } | 2421 | } |
| 2402 | 2422 | ||
| 2403 | ctx = cpuctx->task_ctx; | 2423 | ctx = cpuctx->task_ctx; |
| @@ -2405,37 +2425,26 @@ static void perf_rotate_context(struct perf_cpu_context *cpuctx) | |||
| 2405 | remove = 0; | 2425 | remove = 0; |
| 2406 | if (ctx->nr_events != ctx->nr_active) | 2426 | if (ctx->nr_events != ctx->nr_active) |
| 2407 | rotate = 1; | 2427 | rotate = 1; |
| 2408 | if (ctx->nr_freq) | ||
| 2409 | freq = 1; | ||
| 2410 | } | 2428 | } |
| 2411 | 2429 | ||
| 2412 | if (!rotate && !freq) | 2430 | if (!rotate) |
| 2413 | goto done; | 2431 | goto done; |
| 2414 | 2432 | ||
| 2415 | perf_ctx_lock(cpuctx, cpuctx->task_ctx); | 2433 | perf_ctx_lock(cpuctx, cpuctx->task_ctx); |
| 2416 | perf_pmu_disable(cpuctx->ctx.pmu); | 2434 | perf_pmu_disable(cpuctx->ctx.pmu); |
| 2417 | 2435 | ||
| 2418 | if (freq) { | 2436 | cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE); |
| 2419 | perf_ctx_adjust_freq(&cpuctx->ctx, interval); | 2437 | if (ctx) |
| 2420 | if (ctx) | 2438 | ctx_sched_out(ctx, cpuctx, EVENT_FLEXIBLE); |
| 2421 | perf_ctx_adjust_freq(ctx, interval); | ||
| 2422 | } | ||
| 2423 | |||
| 2424 | if (rotate) { | ||
| 2425 | cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE); | ||
| 2426 | if (ctx) | ||
| 2427 | ctx_sched_out(ctx, cpuctx, EVENT_FLEXIBLE); | ||
| 2428 | 2439 | ||
| 2429 | rotate_ctx(&cpuctx->ctx); | 2440 | rotate_ctx(&cpuctx->ctx); |
| 2430 | if (ctx) | 2441 | if (ctx) |
| 2431 | rotate_ctx(ctx); | 2442 | rotate_ctx(ctx); |
| 2432 | 2443 | ||
| 2433 | perf_event_sched_in(cpuctx, ctx, current); | 2444 | perf_event_sched_in(cpuctx, ctx, current); |
| 2434 | } | ||
| 2435 | 2445 | ||
| 2436 | perf_pmu_enable(cpuctx->ctx.pmu); | 2446 | perf_pmu_enable(cpuctx->ctx.pmu); |
| 2437 | perf_ctx_unlock(cpuctx, cpuctx->task_ctx); | 2447 | perf_ctx_unlock(cpuctx, cpuctx->task_ctx); |
| 2438 | |||
| 2439 | done: | 2448 | done: |
| 2440 | if (remove) | 2449 | if (remove) |
| 2441 | list_del_init(&cpuctx->rotation_list); | 2450 | list_del_init(&cpuctx->rotation_list); |
| @@ -2445,10 +2454,22 @@ void perf_event_task_tick(void) | |||
| 2445 | { | 2454 | { |
