public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Adrian Bunk <bunk@kernel.org>, Josh Triplett <josh@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: 2.6.23-rc2-mm1: rcutorture xtime usage
Date: Fri, 10 Aug 2007 17:29:49 -0700	[thread overview]
Message-ID: <20070811002949.GA7918@linux.vnet.ibm.com> (raw)
In-Reply-To: <20070810203055.GE8511@linux.vnet.ibm.com>

On Fri, Aug 10, 2007 at 01:30:55PM -0700, Paul E. McKenney wrote:
> On Fri, Aug 10, 2007 at 10:12:12AM -0700, Andrew Morton wrote:
> > On Fri, 10 Aug 2007 08:12:08 -0700 "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> wrote:
> > 
> > > > One used to use sched_clock() for this, then get frowned at.  Now we
> > > > have cpu_clock()...
> > > 
> > > Hmmm...  And cpu_clock() is not in 2.6.22, so must appear in some later
> > > release.  Which means that the rate of API change in this area is a
> > > bit high, so I should avoid it like the plague.
> > 
> > eh, it's been there for weeks.  It is dust-encrusted.
> > 
> > >  Therefore, I should
> > > look for some other convenient source of entropy.
> > > 
> > > One convenient source would the per-CPU statistics that rcutorture
> > > maintains.  Of course, a given CPU's RNG is nearly in lock-step with
> > > its own statistics, but not with the adjacent CPU's statistics...
> > > 
> > > I will send a patch.
> > 
> > Please use cpu_clock().  It ain't going away.
> 
> D'accord...

Errmmm...  No joy.

	ERROR: "cpu_clock" [kernel/rcutorture.ko] undefined!

Turns out that cpu_clock also ain't exported, and rcutorture.c is
a module.  Would adding an EXPORT_SYMBOL_GPL() as in the patch below
be acceptable?

If not, I have a tested patch to rcutorture.c that leverages statistical
counters.  Your choice.

						Thanx, Paul

Add an EXPORT_SYMBOL_GPL() for cpu_clock() and make rcutorture.c use it.
Compiles, but not yet tested.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---

 rcutorture.c |    8 ++------
 sched.c      |    2 ++
 2 files changed, 4 insertions(+), 6 deletions(-)

diff -urpNa -X dontdiff linux-2.6.23-rc2/kernel/rcutorture.c linux-2.6.23-rc2-rcutorturesched/kernel/rcutorture.c
--- linux-2.6.23-rc2/kernel/rcutorture.c	2007-08-03 19:49:55.000000000 -0700
+++ linux-2.6.23-rc2-rcutorturesched/kernel/rcutorture.c	2007-08-10 17:15:22.000000000 -0700
@@ -42,7 +42,6 @@
 #include <linux/notifier.h>
 #include <linux/freezer.h>
 #include <linux/cpu.h>
-#include <linux/random.h>
 #include <linux/delay.h>
 #include <linux/byteorder/swabb.h>
 #include <linux/stat.h>
@@ -166,16 +165,13 @@ struct rcu_random_state {
 
 /*
  * Crude but fast random-number generator.  Uses a linear congruential
- * generator, with occasional help from get_random_bytes().
+ * generator, with occasional help from cpu_clock().
  */
 static unsigned long
 rcu_random(struct rcu_random_state *rrsp)
 {
-	long refresh;
-
 	if (--rrsp->rrs_count < 0) {
-		get_random_bytes(&refresh, sizeof(refresh));
-		rrsp->rrs_state += refresh;
+		rrsp->rrs_state += (unsigned long)cpu_clock(smp_processor_id());
 		rrsp->rrs_count = RCU_RANDOM_REFRESH;
 	}
 	rrsp->rrs_state = rrsp->rrs_state * RCU_RANDOM_MULT + RCU_RANDOM_ADD;
diff -urpNa -X dontdiff linux-2.6.23-rc2/kernel/sched.c linux-2.6.23-rc2-rcutorturesched/kernel/sched.c
--- linux-2.6.23-rc2/kernel/sched.c	2007-08-03 19:49:55.000000000 -0700
+++ linux-2.6.23-rc2-rcutorturesched/kernel/sched.c	2007-08-10 17:22:57.000000000 -0700
@@ -394,6 +394,8 @@ unsigned long long cpu_clock(int cpu)
 	return now;
 }
 
+EXPORT_SYMBOL_GPL(cpu_clock);
+
 #ifdef CONFIG_FAIR_GROUP_SCHED
 /* Change a task's ->cfs_rq if it moves across CPUs */
 static inline void set_task_cfs_rq(struct task_struct *p)

  reply	other threads:[~2007-08-11  0:29 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-09  8:51 2.6.23-rc2-mm1 Andrew Morton
2007-08-09 10:10 ` [usb-storage] schedule_timeout: wrong timeout value c1a95554 Mariusz Kozlowski
2007-08-09 14:43   ` [linux-usb-devel] " Alan Stern
2007-08-09 15:07     ` Rafael J. Wysocki
2007-08-09 15:20       ` Mariusz Kozlowski
2007-08-09 19:15         ` Rafael J. Wysocki
2007-08-09 12:53 ` 2.6.23-rc2-mm1 -- spinlock bad magic Andy Whitcroft
2007-08-09 17:17   ` Andy Whitcroft
2007-08-09 13:04 ` 2.6.23-rc2-mm1 -- PPC G5 kernel compile failure Andy Whitcroft
2007-08-09 14:20   ` 2.6.23-rc2-mm1 -- PPC G5 kernel compile failure (patch) Krzysztof Helt
2007-08-09 17:18     ` Andy Whitcroft
2007-08-10 13:09     ` Andy Whitcroft
2007-08-09 13:23 ` 2.6.23-rc2-mm1 Michal Piotrowski
2007-08-09 18:37   ` 2.6.23-rc2-mm1 Andrew Morton
2007-08-09 19:04     ` 2.6.23-rc2-mm1 Michal Piotrowski
2007-08-09 19:10       ` 2.6.23-rc2-mm1 Andrew Morton
2007-08-09 19:27         ` 2.6.23-rc2-mm1 Jeff Garzik
2007-08-09 13:51 ` 2.6.23-rc2-mm1: e1000e global symbols must be renamed Adrian Bunk
2007-08-09 17:06   ` [E1000-devel] " Kok, Auke
2007-08-09 14:24 ` 2.6.23-rc2-mm1: no bcm43xx Rafael J. Wysocki
2007-08-09 14:16   ` Michael Buesch
2007-08-09 15:11 ` 2.6.23-rc2-mm1: kernel BUG at mm/swap_state.c:78! Mariusz Kozlowski
2007-08-09 15:14   ` Adrian Bunk
2007-08-09 15:25     ` Mariusz Kozlowski
2007-08-09 15:37   ` Hugh Dickins
2007-08-09 16:00     ` Michal Piotrowski
2007-08-10  0:30     ` Nick Piggin
2007-08-09 15:36 ` 2.6.23-rc2-mm1 Michal Piotrowski
2007-08-09 16:19   ` 2.6.23-rc2-mm1 Michal Piotrowski
2007-08-09 17:04     ` 2.6.23-rc2-mm1 Andrew Morton
2007-08-09 16:31   ` 2.6.23-rc2-mm1 Andrew Morton
2007-08-09 20:17 ` 2.6.23-rc2-mm1: silly df numbers on 32bit extN Hugh Dickins
2007-08-09 20:56   ` Andrew Morton
2007-08-09 20:30 ` 2.6.23-rc2-mm1 Jesper Juhl
2007-08-09 21:36 ` 2.6.23-rc2-mm1 Gabriel C
2007-08-09 22:04   ` 2.6.23-rc2-mm1 Andrew Morton
2007-08-09 22:42     ` 2.6.23-rc2-mm1 Alan Cox
2007-08-09 23:33       ` 2.6.23-rc2-mm1 Gabriel C
2007-08-09 23:23 ` 2.6.23-rc2-mm1: sleeping function called from invalid context at kernel/mutex.c:86 Mariusz Kozlowski
2007-08-10  0:11   ` Andrew Morton
2007-08-10  5:36     ` Josh Triplett
2007-08-10  7:27       ` Mariusz Kozlowski
2007-08-10  7:40     ` Ingo Molnar
2007-08-10  7:55       ` Andrew Morton
2007-08-11  7:24         ` Alexey Dobriyan
2007-08-09 23:49 ` 2.6.23-rc2-mm1: rtl8139 inconsistent lock state Mariusz Kozlowski
2007-08-22 13:35   ` [PATCH 2.6.23-rc3-mm1] request_irq fix DEBUG_SHIRQ handling " Jarek Poplawski
2007-08-25  9:43     ` Mariusz Kozlowski
2007-08-27  5:54       ` Jarek Poplawski
2007-08-23  8:44   ` [PATCH (take 2)] " Jarek Poplawski
2007-08-24  5:46     ` Jarek Poplawski
2007-08-10  1:31 ` 2.6.23-rc2-mm1: rcutorture xtime usage Adrian Bunk
2007-08-10  2:00   ` Paul E. McKenney
2007-08-10  2:06     ` Andrew Morton
2007-08-10 15:12       ` Paul E. McKenney
2007-08-10 17:12         ` Andrew Morton
2007-08-10 20:30           ` Paul E. McKenney
2007-08-11  0:29             ` Paul E. McKenney [this message]
2007-08-11  4:47               ` Paul E. McKenney
2007-08-11 18:09               ` Ingo Molnar
2007-08-11 19:39                 ` Paul E. McKenney
2007-08-10  2:22     ` Adrian Bunk
2007-08-10  7:06 ` 2.6.23-rc2-mm1: irq lock inversion dependency detected Mariusz Kozlowski
2007-08-24  8:27   ` Jarek Poplawski
2007-08-24  8:50     ` Jarek Poplawski
2007-08-14 21:22 ` [-mm patch] make fs/nfsd/nfs4callback.c:do_probe_callback() static Adrian Bunk
2007-08-14 22:02   ` J. Bruce Fields
2007-08-14 21:23 ` [-mm patch] make drivers/ata/libata-scsi.c:ata_scsi_link_pm_policy() static Adrian Bunk
2007-08-14 21:23 ` [-mm patch] unexport ide_acpi_set_state Adrian Bunk
2007-08-14 21:23 ` [-mm patch] drivers/mtd/mtdbdi.c is no longer an own module Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070811002949.GA7918@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=bunk@kernel.org \
    --cc=josh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox