Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100256
b: refs/heads/master
c: c0c8773
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Jul 11, 2008
1 parent a70c45d commit c9292c2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 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: 2b8a0cf4890d7537a77b51caa8f508e4a05a0e67
refs/heads/master: c0c87734f125d2fa8ebc70310f3257fa6209f2b6
25 changes: 16 additions & 9 deletions trunk/kernel/sched_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static int check_max(struct sched_clock_data *scd)
* - filter out backward motion
* - use jiffies to generate a min,max window to clip the raw values
*/
static void __update_sched_clock(struct sched_clock_data *scd, u64 now)
static void __update_sched_clock(struct sched_clock_data *scd, u64 now, u64 *time)
{
unsigned long now_jiffies = jiffies;
long delta_jiffies = now_jiffies - scd->tick_jiffies;
Expand Down Expand Up @@ -162,8 +162,12 @@ static void __update_sched_clock(struct sched_clock_data *scd, u64 now)
if (unlikely(clock < min_clock))
clock = min_clock;

scd->prev_raw = now;
scd->clock = clock;
if (time)
*time = clock;
else {
scd->prev_raw = now;
scd->clock = clock;
}
}

static void lock_double_clock(struct sched_clock_data *data1,
Expand Down Expand Up @@ -207,15 +211,18 @@ u64 sched_clock_cpu(int cpu)
now -= scd->tick_gtod;

__raw_spin_unlock(&my_scd->lock);

__update_sched_clock(scd, now, &clock);

__raw_spin_unlock(&scd->lock);

} else {
__raw_spin_lock(&scd->lock);
__update_sched_clock(scd, now, NULL);
clock = scd->clock;
__raw_spin_unlock(&scd->lock);
}

__update_sched_clock(scd, now);
clock = scd->clock;

__raw_spin_unlock(&scd->lock);

return clock;
}

Expand All @@ -234,7 +241,7 @@ void sched_clock_tick(void)
now_gtod = ktime_to_ns(ktime_get());

__raw_spin_lock(&scd->lock);
__update_sched_clock(scd, now);
__update_sched_clock(scd, now, NULL);
/*
* update tick_gtod after __update_sched_clock() because that will
* already observe 1 new jiffy; adding a new tick_gtod to that would
Expand Down

0 comments on commit c9292c2

Please sign in to comment.