Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7357
b: refs/heads/master
c: 486d46a
h: refs/heads/master
i:
  7355: 39cbb3b
v: v3
  • Loading branch information
Alex Williamson authored and Linus Torvalds committed Sep 7, 2005
1 parent f16e1ea commit c660a80
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 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: 9f4a6dce10941380ad7365cc9b0ef038ed56cbf9
refs/heads/master: 486d46aefe7ded0d343e306be740edd972aff740
17 changes: 13 additions & 4 deletions trunk/kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ static inline u64 time_interpolator_get_cycles(unsigned int src)
}
}

static inline u64 time_interpolator_get_counter(void)
static inline u64 time_interpolator_get_counter(int writelock)
{
unsigned int src = time_interpolator->source;

Expand All @@ -1443,6 +1443,15 @@ static inline u64 time_interpolator_get_counter(void)
now = time_interpolator_get_cycles(src);
if (lcycle && time_after(lcycle, now))
return lcycle;

/* When holding the xtime write lock, there's no need
* to add the overhead of the cmpxchg. Readers are
* force to retry until the write lock is released.
*/
if (writelock) {
time_interpolator->last_cycle = now;
return now;
}
/* Keep track of the last timer value returned. The use of cmpxchg here
* will cause contention in an SMP environment.
*/
Expand All @@ -1456,7 +1465,7 @@ static inline u64 time_interpolator_get_counter(void)
void time_interpolator_reset(void)
{
time_interpolator->offset = 0;
time_interpolator->last_counter = time_interpolator_get_counter();
time_interpolator->last_counter = time_interpolator_get_counter(1);
}

#define GET_TI_NSECS(count,i) (((((count) - i->last_counter) & (i)->mask) * (i)->nsec_per_cyc) >> (i)->shift)
Expand All @@ -1468,7 +1477,7 @@ unsigned long time_interpolator_get_offset(void)
return 0;

return time_interpolator->offset +
GET_TI_NSECS(time_interpolator_get_counter(), time_interpolator);
GET_TI_NSECS(time_interpolator_get_counter(0), time_interpolator);
}

#define INTERPOLATOR_ADJUST 65536
Expand All @@ -1491,7 +1500,7 @@ static void time_interpolator_update(long delta_nsec)
* and the tuning logic insures that.
*/

counter = time_interpolator_get_counter();
counter = time_interpolator_get_counter(1);
offset = time_interpolator->offset + GET_TI_NSECS(counter, time_interpolator);

if (delta_nsec < 0 || (unsigned long) delta_nsec < offset)
Expand Down

0 comments on commit c660a80

Please sign in to comment.