Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108211
b: refs/heads/master
c: c1955a3
h: refs/heads/master
i:
  108209: 94ef5ec
  108207: d6b1589
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Aug 11, 2008
1 parent 7c7126a commit 80cd875
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 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: 4a273f209cc95d148f79b4c96d3d03997b44ffda
refs/heads/master: c1955a3d4762e7a9bf84035eb3c4886a900f0d15
14 changes: 3 additions & 11 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -1551,16 +1551,10 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)

extern unsigned long long sched_clock(void);

#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
static inline void sched_clock_init(void)
{
}

static inline u64 sched_clock_cpu(int cpu)
{
return sched_clock();
}
extern void sched_clock_init(void);
extern u64 sched_clock_cpu(int cpu);

#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
static inline void sched_clock_tick(void)
{
}
Expand All @@ -1573,8 +1567,6 @@ static inline void sched_clock_idle_wakeup_event(u64 delta_ns)
{
}
#else
extern void sched_clock_init(void);
extern u64 sched_clock_cpu(int cpu);
extern void sched_clock_tick(void);
extern void sched_clock_idle_sleep_event(void);
extern void sched_clock_idle_wakeup_event(u64 delta_ns);
Expand Down
19 changes: 17 additions & 2 deletions trunk/kernel/sched_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ unsigned long long __attribute__((weak)) sched_clock(void)
return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ);
}

static __read_mostly int sched_clock_running;

#ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK

struct sched_clock_data {
Expand Down Expand Up @@ -70,8 +72,6 @@ static inline struct sched_clock_data *cpu_sdc(int cpu)
return &per_cpu(sched_clock_data, cpu);
}

static __read_mostly int sched_clock_running;

void sched_clock_init(void)
{
u64 ktime_now = ktime_to_ns(ktime_get());
Expand Down Expand Up @@ -248,6 +248,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

unsigned long long cpu_clock(int cpu)
Expand Down

0 comments on commit 80cd875

Please sign in to comment.