All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rcu: refine structure rcu_node field for rcu boost
@ 2018-01-18 10:33 Liu, Changcheng
  2018-01-18 17:38 ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: Liu, Changcheng @ 2018-01-18 10:33 UTC (permalink / raw)
  To: Lai Jiangshan, Mathieu Desnoyers, Paul E. McKenney
  Cc: linux-kernel, changcheng.liu

Do not allocate space for rcu boost field when
RCU BOOST is not configured.

Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>

diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 46a5d19..88f087e 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -129,6 +129,7 @@ struct rcu_node {
 				/*  if there is no such task.  If there */
 				/*  is no current expedited grace period, */
 				/*  then there can cannot be any such task. */
+#ifdef CONFIG_RCU_BOOST
 	struct list_head *boost_tasks;
 				/* Pointer to first task that needs to be */
 				/*  priority boosted, or NULL if no priority */
@@ -153,6 +154,8 @@ struct rcu_node {
 				/* Number of tasks boosted for expedited GP. */
 	unsigned long n_normal_boosts;
 				/* Number of tasks boosted for normal GP. */
+#endif/* #ifdef CONFIG_RCU_BOOST*/
+
 #ifdef CONFIG_RCU_NOCB_CPU
 	struct swait_queue_head nocb_gp_wq[2];
 				/* Place for rcu_nocb_kthread() to wait GP. */
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index db85ca3..fee0b1e 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -506,8 +506,10 @@ void rcu_read_unlock_special(struct task_struct *t)
 		if (IS_ENABLED(CONFIG_RCU_BOOST)) {
 			/* Snapshot ->boost_mtx ownership w/rnp->lock held. */
 			drop_boost_mutex = rt_mutex_owner(&rnp->boost_mtx) == t;
+#ifdef CONFIG_RCU_BOOST
 			if (&t->rcu_node_entry == rnp->boost_tasks)
 				rnp->boost_tasks = np;
+#endif
 		}
 
 		/*
-- 
2.7.4

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

* Re: [PATCH] rcu: refine structure rcu_node field for rcu boost
  2018-01-18 10:33 [PATCH] rcu: refine structure rcu_node field for rcu boost Liu, Changcheng
@ 2018-01-18 17:38 ` Paul E. McKenney
  2018-01-19  1:21   ` Liu, Changcheng
  0 siblings, 1 reply; 3+ messages in thread
From: Paul E. McKenney @ 2018-01-18 17:38 UTC (permalink / raw)
  To: Liu, Changcheng; +Cc: Lai Jiangshan, Mathieu Desnoyers, linux-kernel

On Thu, Jan 18, 2018 at 06:33:43PM +0800, Liu, Changcheng wrote:
> Do not allocate space for rcu boost field when
> RCU BOOST is not configured.
> 
> Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>

The added #ifdef in rcu_read_unlock_special() is a deal-breaker.
Just out of curiosity, is this decrease in storage measurable at
the system level?

							Thanx, Paul

> diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
> index 46a5d19..88f087e 100644
> --- a/kernel/rcu/tree.h
> +++ b/kernel/rcu/tree.h
> @@ -129,6 +129,7 @@ struct rcu_node {
>  				/*  if there is no such task.  If there */
>  				/*  is no current expedited grace period, */
>  				/*  then there can cannot be any such task. */
> +#ifdef CONFIG_RCU_BOOST
>  	struct list_head *boost_tasks;
>  				/* Pointer to first task that needs to be */
>  				/*  priority boosted, or NULL if no priority */
> @@ -153,6 +154,8 @@ struct rcu_node {
>  				/* Number of tasks boosted for expedited GP. */
>  	unsigned long n_normal_boosts;
>  				/* Number of tasks boosted for normal GP. */
> +#endif/* #ifdef CONFIG_RCU_BOOST*/
> +
>  #ifdef CONFIG_RCU_NOCB_CPU
>  	struct swait_queue_head nocb_gp_wq[2];
>  				/* Place for rcu_nocb_kthread() to wait GP. */
> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> index db85ca3..fee0b1e 100644
> --- a/kernel/rcu/tree_plugin.h
> +++ b/kernel/rcu/tree_plugin.h
> @@ -506,8 +506,10 @@ void rcu_read_unlock_special(struct task_struct *t)
>  		if (IS_ENABLED(CONFIG_RCU_BOOST)) {
>  			/* Snapshot ->boost_mtx ownership w/rnp->lock held. */
>  			drop_boost_mutex = rt_mutex_owner(&rnp->boost_mtx) == t;
> +#ifdef CONFIG_RCU_BOOST
>  			if (&t->rcu_node_entry == rnp->boost_tasks)
>  				rnp->boost_tasks = np;
> +#endif
>  		}
> 
>  		/*
> -- 
> 2.7.4
> 

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

* Re: [PATCH] rcu: refine structure rcu_node field for rcu boost
  2018-01-18 17:38 ` Paul E. McKenney
@ 2018-01-19  1:21   ` Liu, Changcheng
  0 siblings, 0 replies; 3+ messages in thread
From: Liu, Changcheng @ 2018-01-19  1:21 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: Lai Jiangshan, Mathieu Desnoyers, linux-kernel

Hi Paul,
	This patch is optional.

    1. It's true that the added #ifdef in rcu_read_unlock_special is a
	bad breaker. The patch follows the current code e.g.
	CONFIG_PROVE_RCU

	2. Haven't evaluated the performance in system.
	Studying RCU and found that boost feature field is allocated in
	in the rcu_node structure even rcu boost isn't enabled.

B.R.
Changcheng

On 09:38 Thu 18 Jan, Paul E. McKenney wrote:
> On Thu, Jan 18, 2018 at 06:33:43PM +0800, Liu, Changcheng wrote:
> > Do not allocate space for rcu boost field when
> > RCU BOOST is not configured.
> > 
> > Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
> 
> The added #ifdef in rcu_read_unlock_special() is a deal-breaker.
> Just out of curiosity, is this decrease in storage measurable at
> the system level?
> 
> 							Thanx, Paul
> 
> > diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
> > index 46a5d19..88f087e 100644
> > --- a/kernel/rcu/tree.h
> > +++ b/kernel/rcu/tree.h
> > @@ -129,6 +129,7 @@ struct rcu_node {
> >  				/*  if there is no such task.  If there */
> >  				/*  is no current expedited grace period, */
> >  				/*  then there can cannot be any such task. */
> > +#ifdef CONFIG_RCU_BOOST
> >  	struct list_head *boost_tasks;
> >  				/* Pointer to first task that needs to be */
> >  				/*  priority boosted, or NULL if no priority */
> > @@ -153,6 +154,8 @@ struct rcu_node {
> >  				/* Number of tasks boosted for expedited GP. */
> >  	unsigned long n_normal_boosts;
> >  				/* Number of tasks boosted for normal GP. */
> > +#endif/* #ifdef CONFIG_RCU_BOOST*/
> > +
> >  #ifdef CONFIG_RCU_NOCB_CPU
> >  	struct swait_queue_head nocb_gp_wq[2];
> >  				/* Place for rcu_nocb_kthread() to wait GP. */
> > diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> > index db85ca3..fee0b1e 100644
> > --- a/kernel/rcu/tree_plugin.h
> > +++ b/kernel/rcu/tree_plugin.h
> > @@ -506,8 +506,10 @@ void rcu_read_unlock_special(struct task_struct *t)
> >  		if (IS_ENABLED(CONFIG_RCU_BOOST)) {
> >  			/* Snapshot ->boost_mtx ownership w/rnp->lock held. */
> >  			drop_boost_mutex = rt_mutex_owner(&rnp->boost_mtx) == t;
> > +#ifdef CONFIG_RCU_BOOST
> >  			if (&t->rcu_node_entry == rnp->boost_tasks)
> >  				rnp->boost_tasks = np;
> > +#endif
> >  		}
> > 
> >  		/*
> > -- 
> > 2.7.4
> > 
> 
> 

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

end of thread, other threads:[~2018-01-19  1:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18 10:33 [PATCH] rcu: refine structure rcu_node field for rcu boost Liu, Changcheng
2018-01-18 17:38 ` Paul E. McKenney
2018-01-19  1:21   ` Liu, Changcheng

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.