Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ef38609 authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by Linus Torvalds
Browse files

[PATCH] kill wall_jiffies



With 2.6.18-rc4-mm2, now wall_jiffies will always be the same as jiffies.
So we can kill wall_jiffies completely.

This is just a cleanup and logically should not change any real behavior
except for one thing: RTC updating code in (old) ppc and xtensa use a
condition "jiffies - wall_jiffies == 1".  This condition is never met so I
suppose it is just a bug.  I just remove that condition only instead of
kill the whole "if" block.

[heiko.carstens@de.ibm.com: s390 build fix and cleanup]
Signed-off-by: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Andi Kleen <ak@muc.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Hirokazu Takata <takata.hirokazu@renesas.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Cc: Richard Curnow <rc@rc0.org.uk>
Cc: William Lee Irwin III <wli@holomorphy.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp>
Cc: Chris Zankel <chris@zankel.net>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 70bc42f9
Loading
Loading
Loading
Loading
+5 −10
Original line number Original line Diff line number Diff line
@@ -54,8 +54,6 @@
#include "proto.h"
#include "proto.h"
#include "irq_impl.h"
#include "irq_impl.h"


extern unsigned long wall_jiffies;	/* kernel/timer.c */

static int set_rtc_mmss(unsigned long);
static int set_rtc_mmss(unsigned long);


DEFINE_SPINLOCK(rtc_lock);
DEFINE_SPINLOCK(rtc_lock);
@@ -413,7 +411,7 @@ void
do_gettimeofday(struct timeval *tv)
do_gettimeofday(struct timeval *tv)
{
{
	unsigned long flags;
	unsigned long flags;
	unsigned long sec, usec, lost, seq;
	unsigned long sec, usec, seq;
	unsigned long delta_cycles, delta_usec, partial_tick;
	unsigned long delta_cycles, delta_usec, partial_tick;


	do {
	do {
@@ -423,14 +421,13 @@ do_gettimeofday(struct timeval *tv)
		sec = xtime.tv_sec;
		sec = xtime.tv_sec;
		usec = (xtime.tv_nsec / 1000);
		usec = (xtime.tv_nsec / 1000);
		partial_tick = state.partial_tick;
		partial_tick = state.partial_tick;
		lost = jiffies - wall_jiffies;


	} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
	} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));


#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
	/* Until and unless we figure out how to get cpu cycle counters
	/* Until and unless we figure out how to get cpu cycle counters
	   in sync and keep them there, we can't use the rpcc tricks.  */
	   in sync and keep them there, we can't use the rpcc tricks.  */
	delta_usec = lost * (1000000 / HZ);
	delta_usec = 0;
#else
#else
	/*
	/*
	 * usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks)
	 * usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks)
@@ -446,8 +443,7 @@ do_gettimeofday(struct timeval *tv)
	 */
	 */


	delta_usec = (delta_cycles * state.scaled_ticks_per_cycle 
	delta_usec = (delta_cycles * state.scaled_ticks_per_cycle 
		      + partial_tick
		      + partial_tick) * 15625;
		      + (lost << FIX_SHIFT)) * 15625;
	delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
	delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
#endif
#endif


@@ -480,12 +476,11 @@ do_settimeofday(struct timespec *tv)
	   time.  Without this, a full-tick error is possible.  */
	   time.  Without this, a full-tick error is possible.  */


#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
	delta_nsec = (jiffies - wall_jiffies) * (NSEC_PER_SEC / HZ);
	delta_nsec = 0;
#else
#else
	delta_nsec = rpcc() - state.last_time;
	delta_nsec = rpcc() - state.last_time;
	delta_nsec = (delta_nsec * state.scaled_ticks_per_cycle 
	delta_nsec = (delta_nsec * state.scaled_ticks_per_cycle 
		      + state.partial_tick
		      + state.partial_tick) * 15625;
		      + ((jiffies - wall_jiffies) << FIX_SHIFT)) * 15625;
	delta_nsec = ((delta_nsec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
	delta_nsec = ((delta_nsec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
	delta_nsec *= 1000;
	delta_nsec *= 1000;
#endif
#endif
+1 −9
Original line number Original line Diff line number Diff line
@@ -37,8 +37,6 @@
 */
 */
struct sys_timer *system_timer;
struct sys_timer *system_timer;


extern unsigned long wall_jiffies;

/* this needs a better home */
/* this needs a better home */
DEFINE_SPINLOCK(rtc_lock);
DEFINE_SPINLOCK(rtc_lock);


@@ -237,16 +235,11 @@ void do_gettimeofday(struct timeval *tv)
{
{
	unsigned long flags;
	unsigned long flags;
	unsigned long seq;
	unsigned long seq;
	unsigned long usec, sec, lost;
	unsigned long usec, sec;


	do {
	do {
		seq = read_seqbegin_irqsave(&xtime_lock, flags);
		seq = read_seqbegin_irqsave(&xtime_lock, flags);
		usec = system_timer->offset();
		usec = system_timer->offset();

		lost = jiffies - wall_jiffies;
		if (lost)
			usec += lost * USECS_PER_JIFFY;

		sec = xtime.tv_sec;
		sec = xtime.tv_sec;
		usec += xtime.tv_nsec / 1000;
		usec += xtime.tv_nsec / 1000;
	} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
	} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -279,7 +272,6 @@ int do_settimeofday(struct timespec *tv)
	 * done, and then undo it!
	 * done, and then undo it!
	 */
	 */
	nsec -= system_timer->offset() * NSEC_PER_USEC;
	nsec -= system_timer->offset() * NSEC_PER_USEC;
	nsec -= (jiffies - wall_jiffies) * TICK_NSEC;


	wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
	wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
	wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
	wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
+2 −10
Original line number Original line Diff line number Diff line
@@ -33,8 +33,6 @@
#include <asm/irq.h>
#include <asm/irq.h>
#include <asm/ioc.h>
#include <asm/ioc.h>


extern unsigned long wall_jiffies;

/* this needs a better home */
/* this needs a better home */
DEFINE_SPINLOCK(rtc_lock);
DEFINE_SPINLOCK(rtc_lock);


@@ -136,16 +134,11 @@ void do_gettimeofday(struct timeval *tv)
{
{
	unsigned long flags;
	unsigned long flags;
	unsigned long seq;
	unsigned long seq;
	unsigned long usec, sec, lost;
	unsigned long usec, sec;


	do {
	do {
		seq = read_seqbegin_irqsave(&xtime_lock, flags);
		seq = read_seqbegin_irqsave(&xtime_lock, flags);
		usec = gettimeoffset();
		usec = gettimeoffset();

		lost = jiffies - wall_jiffies;
		if (lost)
			usec += lost * USECS_PER_JIFFY;

		sec = xtime.tv_sec;
		sec = xtime.tv_sec;
		usec += xtime.tv_nsec / 1000;
		usec += xtime.tv_nsec / 1000;
	} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
	} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -174,8 +167,7 @@ int do_settimeofday(struct timespec *tv)
	 * wall time.  Discover what correction gettimeofday() would have
	 * wall time.  Discover what correction gettimeofday() would have
	 * done, and then undo it!
	 * done, and then undo it!
	 */
	 */
	tv->tv_nsec -= 1000 * (gettimeoffset() +
	tv->tv_nsec -= 1000 * gettimeoffset();
			(jiffies - wall_jiffies) * USECS_PER_JIFFY);


	while (tv->tv_nsec < 0) {
	while (tv->tv_nsec < 0) {
		tv->tv_nsec += NSEC_PER_SEC;
		tv->tv_nsec += NSEC_PER_SEC;
+0 −7
Original line number Original line Diff line number Diff line
@@ -37,7 +37,6 @@ int have_rtc; /* used to remember if we have an RTC or not */;


#define TICK_SIZE tick
#define TICK_SIZE tick


extern unsigned long wall_jiffies;
extern unsigned long loops_per_jiffy; /* init/main.c */
extern unsigned long loops_per_jiffy; /* init/main.c */
unsigned long loops_per_usec;
unsigned long loops_per_usec;


@@ -58,11 +57,6 @@ void do_gettimeofday(struct timeval *tv)
	local_irq_save(flags);
	local_irq_save(flags);
	local_irq_disable();
	local_irq_disable();
	usec = do_gettimeoffset();
	usec = do_gettimeoffset();
	{
		unsigned long lost = jiffies - wall_jiffies;
		if (lost)
			usec += lost * (1000000 / HZ);
	}


        /*
        /*
	 * If time_adjust is negative then NTP is slowing the clock
	 * If time_adjust is negative then NTP is slowing the clock
@@ -103,7 +97,6 @@ int do_settimeofday(struct timespec *tv)
	 * made, and then undo it!
	 * made, and then undo it!
	 */
	 */
	nsec -= do_gettimeoffset() * NSEC_PER_USEC;
	nsec -= do_gettimeoffset() * NSEC_PER_USEC;
	nsec -= (jiffies - wall_jiffies) * TICK_NSEC;


	wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
	wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
	wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
	wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
+0 −3
Original line number Original line Diff line number Diff line
@@ -76,8 +76,6 @@ int pit_latch_buggy; /* extern */
unsigned int cpu_khz;	/* Detected as we calibrate the TSC */
unsigned int cpu_khz;	/* Detected as we calibrate the TSC */
EXPORT_SYMBOL(cpu_khz);
EXPORT_SYMBOL(cpu_khz);


extern unsigned long wall_jiffies;

DEFINE_SPINLOCK(rtc_lock);
DEFINE_SPINLOCK(rtc_lock);
EXPORT_SYMBOL(rtc_lock);
EXPORT_SYMBOL(rtc_lock);


@@ -329,7 +327,6 @@ static int timer_resume(struct sys_device *dev)
	do_settimeofday(&ts);
	do_settimeofday(&ts);
	write_seqlock_irqsave(&xtime_lock, flags);
	write_seqlock_irqsave(&xtime_lock, flags);
	jiffies_64 += sleep_length;
	jiffies_64 += sleep_length;
	wall_jiffies += sleep_length;
	write_sequnlock_irqrestore(&xtime_lock, flags);
	write_sequnlock_irqrestore(&xtime_lock, flags);
	touch_softlockup_watchdog();
	touch_softlockup_watchdog();
	return 0;
	return 0;
Loading