All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 000/003] Remove getnstimestamp()
@ 2005-12-15  4:29 Matt Helsley
  2005-12-15  4:32 ` [PATCH 001/003] Export ktime_get_ts() Matt Helsley
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Matt Helsley @ 2005-12-15  4:29 UTC (permalink / raw)
  To: Andrew Morton
  Cc: john stultz, Thomas Gleixner, Shailabh Nagar, Christoph Lameter,
	linux-kernel, Jay Lan, George Anzinger

	This series removes the getnstimestamp() function from kernel/time.c in
favor of kernel/hrtimer.c's ktime_get_ts() function which currently does
exactly the same thing: retrieves a high-resolution (ns) timespec
structure and performs the wall_to_monotonic adjustment.

	As Jay Lan suggested I was going to replace calls to getnstimestamp()
with do_posix_clock_monotonic_gettime() but the hrtimer patches switched
that to a macro. ktime_get_ts() is shorter and avoids unnecessary
association with posix timers (though it does not emphasize monotonicity
or resolution).

The series:

001/003 export-ktime_get_ts.patch
	Exports ktime_get_ts()

002/003 proc-events-use-ktime-for-timestamp.patch
	Switches the only user of getnstimestamp() to ktime_get_ts()

003/003 rm-getnstimestamp.patch
	Remove getnstimestamp() from kernel/time.c


Thanks,
	-Matt Helsley



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 001/003] Export ktime_get_ts()
  2005-12-15  4:29 [PATCH 000/003] Remove getnstimestamp() Matt Helsley
@ 2005-12-15  4:32 ` Matt Helsley
  2005-12-15  4:35 ` [PATCH 002/003] Switch getnstimestamp() calls to ktime_get_ts() Matt Helsley
  2005-12-15  4:36 ` [PATCH 003/003] Remove getnstimestamp() Matt Helsley
  2 siblings, 0 replies; 4+ messages in thread
From: Matt Helsley @ 2005-12-15  4:32 UTC (permalink / raw)
  To: Andrew Morton
  Cc: john stultz, Thomas Gleixner, Shailabh Nagar, Christoph Lameter,
	linux-kernel, Jay Lan, George Anzinger

Export ktime_get_ts() to be used as a timestamp function since it
uses getnstimefoday() and does the wall_to_monotonic adjustment.

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>

--

Index: linux-2.6.15-rc5-mm1/kernel/hrtimer.c
===================================================================
--- linux-2.6.15-rc5-mm1.orig/kernel/hrtimer.c
+++ linux-2.6.15-rc5-mm1/kernel/hrtimer.c
@@ -106,10 +106,11 @@ void ktime_get_ts(struct timespec *ts)
 	} while (read_seqretry(&xtime_lock, seq));
 
 	set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec,
 				ts->tv_nsec + tomono.tv_nsec);
 }
+EXPORT_SYMBOL_GPL(ktime_get_ts);
 
 /*
  * Functions and macros which are different for UP/SMP systems are kept in a
  * single place
  */



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 002/003] Switch getnstimestamp() calls to ktime_get_ts()
  2005-12-15  4:29 [PATCH 000/003] Remove getnstimestamp() Matt Helsley
  2005-12-15  4:32 ` [PATCH 001/003] Export ktime_get_ts() Matt Helsley
@ 2005-12-15  4:35 ` Matt Helsley
  2005-12-15  4:36 ` [PATCH 003/003] Remove getnstimestamp() Matt Helsley
  2 siblings, 0 replies; 4+ messages in thread
From: Matt Helsley @ 2005-12-15  4:35 UTC (permalink / raw)
  To: Andrew Morton
  Cc: john stultz, Thomas Gleixner, Shailabh Nagar, Christoph Lameter,
	linux-kernel, Jay Lan, George Anzinger

Use ktime_get_ts() to take the timestamp instead of getnstimestamp(). This
patch prepares to remove getnstimestamp() by switching its only user to
a different function with almost exactly the same code.

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>

--

Index: linux-2.6.15-rc5-mm2/drivers/connector/cn_proc.c
===================================================================
--- linux-2.6.15-rc5-mm2.orig/drivers/connector/cn_proc.c
+++ linux-2.6.15-rc5-mm2/drivers/connector/cn_proc.c
@@ -22,10 +22,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/ktime.h>
 #include <linux/init.h>
 #include <asm/atomic.h>
 
 #include <linux/cn_proc.h>
 
@@ -54,11 +55,11 @@ void proc_fork_connector(struct task_str
 		return;
 
 	msg = (struct cn_msg*)buffer;
 	ev = (struct proc_event*)msg->data;
 	get_seq(&msg->seq, &ev->cpu);
-	getnstimestamp(&ev->timestamp);
+	ktime_get_ts(&ev->timestamp); /* get high res monotonic timestamp */
 	ev->what = PROC_EVENT_FORK;
 	ev->event_data.fork.parent_pid = task->real_parent->pid;
 	ev->event_data.fork.parent_tgid = task->real_parent->tgid;
 	ev->event_data.fork.child_pid = task->pid;
 	ev->event_data.fork.child_tgid = task->tgid;
@@ -80,11 +81,11 @@ void proc_exec_connector(struct task_str
 		return;
 
 	msg = (struct cn_msg*)buffer;
 	ev = (struct proc_event*)msg->data;
 	get_seq(&msg->seq, &ev->cpu);
-	getnstimestamp(&ev->timestamp);
+	ktime_get_ts(&ev->timestamp);
 	ev->what = PROC_EVENT_EXEC;
 	ev->event_data.exec.process_pid = task->pid;
 	ev->event_data.exec.process_tgid = task->tgid;
 
 	memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
@@ -114,11 +115,11 @@ void proc_id_connector(struct task_struc
 	   	ev->event_data.id.r.rgid = task->gid;
 	   	ev->event_data.id.e.egid = task->egid;
 	} else
 	     	return;
 	get_seq(&msg->seq, &ev->cpu);
-	getnstimestamp(&ev->timestamp);
+	ktime_get_ts(&ev->timestamp);
 
 	memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
 	msg->ack = 0; /* not used */
 	msg->len = sizeof(*ev);
 	cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
@@ -134,11 +135,11 @@ void proc_exit_connector(struct task_str
 		return;
 
 	msg = (struct cn_msg*)buffer;
 	ev = (struct proc_event*)msg->data;
 	get_seq(&msg->seq, &ev->cpu);
-	getnstimestamp(&ev->timestamp);
+	ktime_get_ts(&ev->timestamp);
 	ev->what = PROC_EVENT_EXIT;
 	ev->event_data.exit.process_pid = task->pid;
 	ev->event_data.exit.process_tgid = task->tgid;
 	ev->event_data.exit.exit_code = task->exit_code;
 	ev->event_data.exit.exit_signal = task->exit_signal;
@@ -167,11 +168,11 @@ static void cn_proc_ack(int err, int rcv
 		return;
 
 	msg = (struct cn_msg*)buffer;
 	ev = (struct proc_event*)msg->data;
 	msg->seq = rcvd_seq;
-	getnstimestamp(&ev->timestamp);
+	ktime_get_ts(&ev->timestamp);
 	ev->cpu = -1;
 	ev->what = PROC_EVENT_NONE;
 	ev->event_data.ack.err = err;
 	memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
 	msg->ack = rcvd_ack + 1;



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 003/003] Remove getnstimestamp()
  2005-12-15  4:29 [PATCH 000/003] Remove getnstimestamp() Matt Helsley
  2005-12-15  4:32 ` [PATCH 001/003] Export ktime_get_ts() Matt Helsley
  2005-12-15  4:35 ` [PATCH 002/003] Switch getnstimestamp() calls to ktime_get_ts() Matt Helsley
@ 2005-12-15  4:36 ` Matt Helsley
  2 siblings, 0 replies; 4+ messages in thread
From: Matt Helsley @ 2005-12-15  4:36 UTC (permalink / raw)
  To: Andrew Morton
  Cc: john stultz, Thomas Gleixner, Shailabh Nagar, Christoph Lameter,
	linux-kernel, Jay Lan, George Anzinger

Remove getnstimestamp() in favor of ktime.h's ktime_get_ts()

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>

--

Index: linux-2.6.15-rc5/kernel/time.c
===================================================================
--- linux-2.6.15-rc5.orig/kernel/time.c
+++ linux-2.6.15-rc5/kernel/time.c
@@ -562,32 +562,10 @@ void getnstimeofday(struct timespec *tv)
 	tv->tv_nsec = x.tv_usec * NSEC_PER_USEC;
 }
 EXPORT_SYMBOL_GPL(getnstimeofday);
 #endif
 
-void getnstimestamp(struct timespec *ts)
-{
-	unsigned int seq;
-	struct timespec wall2mono;
-
-	/* synchronize with settimeofday() changes */
-	do {
-		seq = read_seqbegin(&xtime_lock);
-		getnstimeofday(ts);
-		wall2mono = wall_to_monotonic;
-	} while(unlikely(read_seqretry(&xtime_lock, seq)));
-
-	/* adjust to monotonicaly-increasing values */
-	ts->tv_sec += wall2mono.tv_sec;
-	ts->tv_nsec += wall2mono.tv_nsec;
-	while (unlikely(ts->tv_nsec >= NSEC_PER_SEC)) {
-		ts->tv_nsec -= NSEC_PER_SEC;
-		ts->tv_sec++;
-	}
-}
-EXPORT_SYMBOL_GPL(getnstimestamp);
-
 /* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
  * Assumes input in normal date format, i.e. 1980-12-31 23:59:59
  * => year=1980, mon=12, day=31, hour=23, min=59, sec=59.
  *
  * [For the Julian calendar (which was used in Russia before 1917,
Index: linux-2.6.15-rc5/include/linux/time.h
===================================================================
--- linux-2.6.15-rc5.orig/include/linux/time.h
+++ linux-2.6.15-rc5/include/linux/time.h
@@ -78,11 +78,10 @@ extern long do_utimes(char __user *filen
 struct itimerval;
 extern int do_setitimer(int which, struct itimerval *value,
 			struct itimerval *ovalue);
 extern int do_getitimer(int which, struct itimerval *value);
 extern void getnstimeofday(struct timespec *tv);
-extern void getnstimestamp(struct timespec *ts);
 
 extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
 
 /**
  * timespec_to_ns - Convert timespec to nanoseconds



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-12-15  4:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-15  4:29 [PATCH 000/003] Remove getnstimestamp() Matt Helsley
2005-12-15  4:32 ` [PATCH 001/003] Export ktime_get_ts() Matt Helsley
2005-12-15  4:35 ` [PATCH 002/003] Switch getnstimestamp() calls to ktime_get_ts() Matt Helsley
2005-12-15  4:36 ` [PATCH 003/003] Remove getnstimestamp() Matt Helsley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.