mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Triplett <josh@freedesktop.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: Re: [PATCH 4/4] rcutorture: use DEFINE_STATIC_SRCU()
Date: Fri, 12 Oct 2012 12:06:45 -0700	[thread overview]
Message-ID: <20121012190645.GA4134@jtriplet-mobl1> (raw)
In-Reply-To: <1350062057-2439-5-git-send-email-laijs@cn.fujitsu.com>

On Sat, Oct 13, 2012 at 01:14:17AM +0800, Lai Jiangshan wrote:
> use DEFINE_STATIC_SRCU() to simplify the rcutorture.c
> 
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

> ---
>  kernel/rcutorture.c |   41 ++++++-----------------------------------
>  1 files changed, 6 insertions(+), 35 deletions(-)
> 
> diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
> index 25b1503..7939edf 100644
> --- a/kernel/rcutorture.c
> +++ b/kernel/rcutorture.c
> @@ -332,7 +332,6 @@ rcu_stutter_wait(char *title)
>  
>  struct rcu_torture_ops {
>  	void (*init)(void);
> -	void (*cleanup)(void);
>  	int (*readlock)(void);
>  	void (*read_delay)(struct rcu_random_state *rrsp);
>  	void (*readunlock)(int idx);
> @@ -424,7 +423,6 @@ static void rcu_torture_deferred_free(struct rcu_torture *p)
>  
>  static struct rcu_torture_ops rcu_ops = {
>  	.init		= NULL,
> -	.cleanup	= NULL,
>  	.readlock	= rcu_torture_read_lock,
>  	.read_delay	= rcu_read_delay,
>  	.readunlock	= rcu_torture_read_unlock,
> @@ -468,7 +466,6 @@ static void rcu_sync_torture_init(void)
>  
>  static struct rcu_torture_ops rcu_sync_ops = {
>  	.init		= rcu_sync_torture_init,
> -	.cleanup	= NULL,
>  	.readlock	= rcu_torture_read_lock,
>  	.read_delay	= rcu_read_delay,
>  	.readunlock	= rcu_torture_read_unlock,
> @@ -486,7 +483,6 @@ static struct rcu_torture_ops rcu_sync_ops = {
>  
>  static struct rcu_torture_ops rcu_expedited_ops = {
>  	.init		= rcu_sync_torture_init,
> -	.cleanup	= NULL,
>  	.readlock	= rcu_torture_read_lock,
>  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */
>  	.readunlock	= rcu_torture_read_unlock,
> @@ -529,7 +525,6 @@ static void rcu_bh_torture_deferred_free(struct rcu_torture *p)
>  
>  static struct rcu_torture_ops rcu_bh_ops = {
>  	.init		= NULL,
> -	.cleanup	= NULL,
>  	.readlock	= rcu_bh_torture_read_lock,
>  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */
>  	.readunlock	= rcu_bh_torture_read_unlock,
> @@ -546,7 +541,6 @@ static struct rcu_torture_ops rcu_bh_ops = {
>  
>  static struct rcu_torture_ops rcu_bh_sync_ops = {
>  	.init		= rcu_sync_torture_init,
> -	.cleanup	= NULL,
>  	.readlock	= rcu_bh_torture_read_lock,
>  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */
>  	.readunlock	= rcu_bh_torture_read_unlock,
> @@ -563,7 +557,6 @@ static struct rcu_torture_ops rcu_bh_sync_ops = {
>  
>  static struct rcu_torture_ops rcu_bh_expedited_ops = {
>  	.init		= rcu_sync_torture_init,
> -	.cleanup	= NULL,
>  	.readlock	= rcu_bh_torture_read_lock,
>  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */
>  	.readunlock	= rcu_bh_torture_read_unlock,
> @@ -582,19 +575,7 @@ static struct rcu_torture_ops rcu_bh_expedited_ops = {
>   * Definitions for srcu torture testing.
>   */
>  
> -static struct srcu_struct srcu_ctl;
> -
> -static void srcu_torture_init(void)
> -{
> -	init_srcu_struct(&srcu_ctl);
> -	rcu_sync_torture_init();
> -}
> -
> -static void srcu_torture_cleanup(void)
> -{
> -	synchronize_srcu(&srcu_ctl);
> -	cleanup_srcu_struct(&srcu_ctl);
> -}
> +DEFINE_STATIC_SRCU(srcu_ctl);
>  
>  static int srcu_torture_read_lock(void) __acquires(&srcu_ctl)
>  {
> @@ -665,8 +646,7 @@ static int srcu_torture_stats(char *page)
>  }
>  
>  static struct rcu_torture_ops srcu_ops = {
> -	.init		= srcu_torture_init,
> -	.cleanup	= srcu_torture_cleanup,
> +	.init		= rcu_sync_torture_init,
>  	.readlock	= srcu_torture_read_lock,
>  	.read_delay	= srcu_read_delay,
>  	.readunlock	= srcu_torture_read_unlock,
> @@ -680,8 +660,7 @@ static struct rcu_torture_ops srcu_ops = {
>  };
>  
>  static struct rcu_torture_ops srcu_sync_ops = {
> -	.init		= srcu_torture_init,
> -	.cleanup	= srcu_torture_cleanup,
> +	.init		= rcu_sync_torture_init,
>  	.readlock	= srcu_torture_read_lock,
>  	.read_delay	= srcu_read_delay,
>  	.readunlock	= srcu_torture_read_unlock,
> @@ -705,8 +684,7 @@ static void srcu_torture_read_unlock_raw(int idx) __releases(&srcu_ctl)
>  }
>  
>  static struct rcu_torture_ops srcu_raw_ops = {
> -	.init		= srcu_torture_init,
> -	.cleanup	= srcu_torture_cleanup,
> +	.init		= rcu_sync_torture_init,
>  	.readlock	= srcu_torture_read_lock_raw,
>  	.read_delay	= srcu_read_delay,
>  	.readunlock	= srcu_torture_read_unlock_raw,
> @@ -720,8 +698,7 @@ static struct rcu_torture_ops srcu_raw_ops = {
>  };
>  
>  static struct rcu_torture_ops srcu_raw_sync_ops = {
> -	.init		= srcu_torture_init,
> -	.cleanup	= srcu_torture_cleanup,
> +	.init		= rcu_sync_torture_init,
>  	.readlock	= srcu_torture_read_lock_raw,
>  	.read_delay	= srcu_read_delay,
>  	.readunlock	= srcu_torture_read_unlock_raw,
> @@ -740,8 +717,7 @@ static void srcu_torture_synchronize_expedited(void)
>  }
>  
>  static struct rcu_torture_ops srcu_expedited_ops = {
> -	.init		= srcu_torture_init,
> -	.cleanup	= srcu_torture_cleanup,
> +	.init		= rcu_sync_torture_init,
>  	.readlock	= srcu_torture_read_lock,
>  	.read_delay	= srcu_read_delay,
>  	.readunlock	= srcu_torture_read_unlock,
> @@ -776,7 +752,6 @@ static void rcu_sched_torture_deferred_free(struct rcu_torture *p)
>  
>  static struct rcu_torture_ops sched_ops = {
>  	.init		= rcu_sync_torture_init,
> -	.cleanup	= NULL,
>  	.readlock	= sched_torture_read_lock,
>  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */
>  	.readunlock	= sched_torture_read_unlock,
> @@ -792,7 +767,6 @@ static struct rcu_torture_ops sched_ops = {
>  
>  static struct rcu_torture_ops sched_sync_ops = {
>  	.init		= rcu_sync_torture_init,
> -	.cleanup	= NULL,
>  	.readlock	= sched_torture_read_lock,
>  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */
>  	.readunlock	= sched_torture_read_unlock,
> @@ -807,7 +781,6 @@ static struct rcu_torture_ops sched_sync_ops = {
>  
>  static struct rcu_torture_ops sched_expedited_ops = {
>  	.init		= rcu_sync_torture_init,
> -	.cleanup	= NULL,
>  	.readlock	= sched_torture_read_lock,
>  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */
>  	.readunlock	= sched_torture_read_unlock,
> @@ -1903,8 +1876,6 @@ rcu_torture_cleanup(void)
>  
>  	rcu_torture_stats_print();  /* -After- the stats thread is stopped! */
>  
> -	if (cur_ops->cleanup)
> -		cur_ops->cleanup();
>  	if (atomic_read(&n_rcu_torture_error) || n_rcu_torture_barrier_error)
>  		rcu_torture_print_module_parms(cur_ops, "End of test: FAILURE");
>  	else if (n_online_successes != n_online_attempts ||
> -- 
> 1.7.7.6
> 

  reply	other threads:[~2012-10-12 19:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-12 17:14 [PATCH 0/4] srcu: Add DEFINE_SRCU() Lai Jiangshan
2012-10-12 17:14 ` [PATCH 1/4] srcu: add my name Lai Jiangshan
2012-10-12 17:14 ` [PATCH 2/4] srcu: export process_srcu() Lai Jiangshan
2012-10-12 17:14 ` [PATCH 3/4] srcu: add DEFINE_SRCU() Lai Jiangshan
2012-10-15 21:56   ` Paul E. McKenney
2012-10-15 22:40     ` Paul E. McKenney
2012-10-12 17:14 ` [PATCH 4/4] rcutorture: use DEFINE_STATIC_SRCU() Lai Jiangshan
2012-10-12 19:06   ` Josh Triplett [this message]
2012-10-15 23:38 ` [PATCH 0/4] srcu: Add DEFINE_SRCU() Paul E. McKenney

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=20121012190645.GA4134@jtriplet-mobl1 \
    --to=josh@freedesktop.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    /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

all inboxes | Powered by JetHome®