Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 135695
b: refs/heads/master
c: 8325d9c
h: refs/heads/master
i:
  135693: ac24934
  135691: 2447280
  135687: fdebd69
  135679: d5790cf
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Feb 26, 2009
1 parent 8ca25e3 commit 71c53d6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 83ce400928680a6c8123d492684b27857f5a2d95
refs/heads/master: 8325d9c09dedf45476f4d6261d1b6a72e4a7453f
31 changes: 20 additions & 11 deletions trunk/kernel/sched_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ static __read_mostly int sched_clock_running;

#ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
__read_mostly int sched_clock_stable;
#else
static const int sched_clock_stable = 1;
#endif

struct sched_clock_data {
/*
Expand Down Expand Up @@ -115,14 +112,9 @@ static u64 __update_sched_clock(struct sched_clock_data *scd, u64 now)
s64 delta = now - scd->tick_raw;
u64 clock, min_clock, max_clock;

WARN_ON_ONCE(!irqs_disabled());

if (unlikely(delta < 0))
delta = 0;

if (unlikely(!sched_clock_running))
return 0ull;

/*
* scd->clock = clamp(scd->tick_gtod + delta,
* max(scd->tick_gtod, scd->clock),
Expand Down Expand Up @@ -201,18 +193,20 @@ u64 sched_clock_cpu(int cpu)
return clock;
}

#ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK

void sched_clock_tick(void)
{
struct sched_clock_data *scd = this_scd();
struct sched_clock_data *scd;
u64 now, now_gtod;

if (sched_clock_stable)
return;

if (unlikely(!sched_clock_running))
return;

WARN_ON_ONCE(!irqs_disabled());

scd = this_scd();
now_gtod = ktime_to_ns(ktime_get());
now = sched_clock();

Expand Down Expand Up @@ -245,6 +239,21 @@ void sched_clock_idle_wakeup_event(u64 delta_ns)
}
EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event);

#else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */

void sched_clock_init(void)
{
sched_clock_running = 1;
}

u64 sched_clock_cpu(int cpu)
{
if (unlikely(!sched_clock_running))
return 0;

return sched_clock();
}

#endif /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */

unsigned long long cpu_clock(int cpu)
Expand Down

0 comments on commit 71c53d6

Please sign in to comment.