Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62879
b: refs/heads/master
c: a941735
h: refs/heads/master
i:
  62877: fd1bcff
  62875: 1c0357b
  62871: e33dba5
  62863: f0fe9a0
  62847: 738901c
v: v3
  • Loading branch information
Linus Torvalds committed Jul 25, 2007
1 parent 7bf555c commit 9f8b589
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 44 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: d37c85571904a622cbabc7a2e04b8c919de75ac0
refs/heads/master: a9417357cff6027f9d6b1740f821baa59f2381f4
5 changes: 3 additions & 2 deletions trunk/drivers/rtc/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg)
{
struct rtc_device *rtc = to_rtc_device(dev);
struct rtc_time tm;
struct timespec ts = current_kernel_time();

if (strncmp(rtc->dev.bus_id,
CONFIG_RTC_HCTOSYS_DEVICE,
Expand All @@ -57,8 +58,8 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg)

/* RTC precision is 1 second; adjust delta for avg 1/2 sec err */
set_normalized_timespec(&delta,
xtime.tv_sec - oldtime,
xtime.tv_nsec - (NSEC_PER_SEC >> 1));
ts.tv_sec - oldtime,
ts.tv_nsec - (NSEC_PER_SEC >> 1));

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/s390/net/ctcmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ ch_action_txdone(fsm_instance * fi, int event, void *arg)
int first = 1;
int i;
unsigned long duration;
struct timespec done_stamp = xtime;
struct timespec done_stamp = current_kernel_time();

DBF_TEXT(trace, 4, __FUNCTION__);

Expand Down Expand Up @@ -730,7 +730,7 @@ ch_action_txdone(fsm_instance * fi, int event, void *arg)
spin_unlock(&ch->collect_lock);
ch->ccw[1].count = ch->trans_skb->len;
fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
ch->prof.send_stamp = xtime;
ch->prof.send_stamp = current_kernel_time();
rc = ccw_device_start(ch->cdev, &ch->ccw[0],
(unsigned long) ch, 0xff, 0);
ch->prof.doios_multi++;
Expand Down Expand Up @@ -2281,7 +2281,7 @@ transmit_skb(struct channel *ch, struct sk_buff *skb)
fsm_newstate(ch->fsm, CH_STATE_TX);
fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
ch->prof.send_stamp = xtime;
ch->prof.send_stamp = current_kernel_time();
rc = ccw_device_start(ch->cdev, &ch->ccw[ccw_idx],
(unsigned long) ch, 0xff, 0);
spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/s390/net/netiucv.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ static void conn_action_txdone(fsm_instance *fi, int event, void *arg)

header.next = 0;
memcpy(skb_put(conn->tx_buff, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN);
conn->prof.send_stamp = xtime;
conn->prof.send_stamp = current_kernel_time();
txmsg.class = 0;
txmsg.tag = 0;
rc = iucv_message_send(conn->path, &txmsg, 0, 0,
Expand Down Expand Up @@ -1185,7 +1185,7 @@ static int netiucv_transmit_skb(struct iucv_connection *conn,
memcpy(skb_put(nskb, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN);

fsm_newstate(conn->fsm, CONN_STATE_TX);
conn->prof.send_stamp = xtime;
conn->prof.send_stamp = current_kernel_time();

msg.tag = 1;
msg.class = 0;
Expand Down
8 changes: 2 additions & 6 deletions trunk/include/linux/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,11 @@ extern int update_persistent_clock(struct timespec now);
extern int no_sync_cmos_clock __read_mostly;
void timekeeping_init(void);

static inline unsigned long get_seconds(void)
{
return xtime.tv_sec;
}

unsigned long get_seconds(void);
struct timespec current_kernel_time(void);

#define CURRENT_TIME (current_kernel_time())
#define CURRENT_TIME_SEC ((struct timespec) { xtime.tv_sec, 0 })
#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })

extern void do_gettimeofday(struct timeval *tv);
extern int do_settimeofday(struct timespec *tv);
Expand Down
2 changes: 1 addition & 1 deletion trunk/kernel/acct.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ static void do_acct_process(struct file *file)
}
#endif
do_div(elapsed, AHZ);
ac.ac_btime = xtime.tv_sec - elapsed;
ac.ac_btime = get_seconds() - elapsed;
/* we really need to bite the bullet and change layout */
ac.ac_uid = current->uid;
ac.ac_gid = current->gid;
Expand Down
6 changes: 1 addition & 5 deletions trunk/kernel/hrtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)

do {
seq = read_seqbegin(&xtime_lock);
#ifdef CONFIG_NO_HZ
getnstimeofday(&xts);
#else
xts = xtime;
#endif
xts = current_kernel_time();
tom = wall_to_monotonic;
} while (read_seqretry(&xtime_lock, seq));

Expand Down
16 changes: 0 additions & 16 deletions trunk/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,22 +215,6 @@ asmlinkage long sys_adjtimex(struct timex __user *txc_p)
return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : ret;
}

inline struct timespec current_kernel_time(void)
{
struct timespec now;
unsigned long seq;

do {
seq = read_seqbegin(&xtime_lock);

now = xtime;
} while (read_seqretry(&xtime_lock, seq));

return now;
}

EXPORT_SYMBOL(current_kernel_time);

/**
* current_fs_time - Return FS time
* @sb: Superblock.
Expand Down
38 changes: 37 additions & 1 deletion trunk/kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,22 @@ EXPORT_SYMBOL(xtime_lock);
struct timespec xtime __attribute__ ((aligned (16)));
struct timespec wall_to_monotonic __attribute__ ((aligned (16)));
static unsigned long total_sleep_time; /* seconds */

EXPORT_SYMBOL(xtime);


#ifdef CONFIG_NO_HZ
static struct timespec xtime_cache __attribute__ ((aligned (16)));
static inline void update_xtime_cache(u64 nsec)
{
xtime_cache = xtime;
timespec_add_ns(&xtime_cache, nsec);
}
#else
#define xtime_cache xtime
/* We do *not* want to evaluate the argument for this case */
#define update_xtime_cache(n) do { } while (0)
#endif

static struct clocksource *clock; /* pointer to current clocksource */


Expand Down Expand Up @@ -478,6 +490,8 @@ void update_wall_time(void)
xtime.tv_nsec = (s64)clock->xtime_nsec >> clock->shift;
clock->xtime_nsec -= (s64)xtime.tv_nsec << clock->shift;

update_xtime_cache(cyc2ns(clock, offset));

/* check to see if there is a new clocksource to use */
change_clocksource();
update_vsyscall(&xtime, clock);
Expand Down Expand Up @@ -509,3 +523,25 @@ void monotonic_to_bootbased(struct timespec *ts)
{
ts->tv_sec += total_sleep_time;
}

unsigned long get_seconds(void)
{
return xtime_cache.tv_sec;
}
EXPORT_SYMBOL(get_seconds);


struct timespec current_kernel_time(void)
{
struct timespec now;
unsigned long seq;

do {
seq = read_seqbegin(&xtime_lock);

now = xtime_cache;
} while (read_seqretry(&xtime_lock, seq));

return now;
}
EXPORT_SYMBOL(current_kernel_time);
2 changes: 1 addition & 1 deletion trunk/kernel/tsacct.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
ac_etime = timespec_to_ns(&ts);
do_div(ac_etime, NSEC_PER_USEC);
stats->ac_etime = ac_etime;
stats->ac_btime = xtime.tv_sec - ts.tv_sec;
stats->ac_btime = get_seconds() - ts.tv_sec;
if (thread_group_leader(tsk)) {
stats->ac_exitcode = tsk->exit_code;
if (tsk->flags & PF_FORKNOEXEC)
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/rxrpc/af_rxrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ static int __init af_rxrpc_init(void)

BUILD_BUG_ON(sizeof(struct rxrpc_skb_priv) > sizeof(dummy_skb->cb));

rxrpc_epoch = htonl(xtime.tv_sec);
rxrpc_epoch = htonl(get_seconds());

ret = -ENOMEM;
rxrpc_call_jar = kmem_cache_create(
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/rxrpc/ar-connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ void rxrpc_put_connection(struct rxrpc_connection *conn)

ASSERTCMP(atomic_read(&conn->usage), >, 0);

conn->put_time = xtime.tv_sec;
conn->put_time = get_seconds();
if (atomic_dec_and_test(&conn->usage)) {
_debug("zombie");
rxrpc_queue_delayed_work(&rxrpc_connection_reap, 0);
Expand Down Expand Up @@ -835,7 +835,7 @@ void rxrpc_connection_reaper(struct work_struct *work)

_enter("");

now = xtime.tv_sec;
now = get_seconds();
earliest = ULONG_MAX;

write_lock_bh(&rxrpc_connection_lock);
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/rxrpc/ar-transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void rxrpc_put_transport(struct rxrpc_transport *trans)

ASSERTCMP(atomic_read(&trans->usage), >, 0);

trans->put_time = xtime.tv_sec;
trans->put_time = get_seconds();
if (unlikely(atomic_dec_and_test(&trans->usage)))
_debug("zombie");
/* let the reaper determine the timeout to avoid a race with
Expand Down Expand Up @@ -219,7 +219,7 @@ static void rxrpc_transport_reaper(struct work_struct *work)

_enter("");

now = xtime.tv_sec;
now = get_seconds();
earliest = ULONG_MAX;

/* extract all the transports that have been dead too long */
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/rxrpc/rxkad.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ static int rxkad_decrypt_ticket(struct rxrpc_connection *conn,
issue = be32_to_cpu(stamp);
}
p += 4;
now = xtime.tv_sec;
now = get_seconds();
_debug("KIV ISSUE: %lx [%lx]", issue, now);

/* check the ticket is in date */
Expand Down

0 comments on commit 9f8b589

Please sign in to comment.