linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Cc: linux-kernel@vger.kernel.org,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	byungchul.park@lge.com, kernel-team@android.com
Subject: Re: [PATCH RFC 2/8] rcu: Clarify usage of cond_resched for tasks-RCU
Date: Mon, 14 May 2018 10:54:54 -0400	[thread overview]
Message-ID: <20180514105454.45946ad3@gandalf.local.home> (raw)
In-Reply-To: <20180514031541.67247-3-joel@joelfernandes.org>

On Sun, 13 May 2018 20:15:35 -0700
"Joel Fernandes (Google)" <joel@joelfernandes.org> wrote:

> Recently we had a discussion about cond_resched unconditionally
> recording a voluntary context switch [1].
> 
> Lets add a comment clarifying that how this API is to be used.
> 
> [1] https://lkml.kernel.org/r/1526027434-21237-1-git-send-email-byungchul.park@lge.com
> 
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>  include/linux/rcupdate.h | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index 743226176350..a9881007ece6 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -159,8 +159,12 @@ static inline void rcu_init_nohz(void) { }
>  	} while (0)
>  
>  /*
> - * Note a voluntary context switch for RCU-tasks benefit.  This is a
> - * macro rather than an inline function to avoid #include hell.
> + * Note an attempt to perform a voluntary context switch for RCU-tasks benefit.
> + *
> + * This is called even in situations where a context switch didn't really
> + * happen even though it was requested. The caller uses it to indicate
> + * traversal of an RCU-tasks quiescent state. This is a macro rather than an
> + * inline function to avoid #include hell.

I don't know. I just don't like the wording. It sounds too much like
it was written by someone that was confused for it being called when a
context switch didn't occur ;-)

What about something more like:

/*
 * This is called to denote a RCU-task quiescent state. It is placed at
 * voluntary preemption points, as RCU-task critical sections may not
 * perform voluntary preemption or scheduling calls. It does not matter
 * if the task is scheduled out or not, just that a voluntary preemption
 * may be done.
 */

>   */
>  #ifdef CONFIG_TASKS_RCU
>  #define rcu_note_voluntary_context_switch_lite(t) \
> @@ -187,7 +191,8 @@ static inline void exit_tasks_rcu_finish(void) { }
>  #endif /* #else #ifdef CONFIG_TASKS_RCU */
>  
>  /**
> - * cond_resched_tasks_rcu_qs - Report potential quiescent states to RCU
> + * cond_resched_tasks_rcu_qs - Report potential quiescent states to RCU.
> + * The quiescent state report is made even if cond_resched() did nothing.

Same thing here.

 * The quiescent state report does not depend on cond_resched() scheduling.

-- Steve


>   *
>   * This macro resembles cond_resched(), except that it is defined to
>   * report potential quiescent states to RCU-tasks even if the cond_resched()

  reply	other threads:[~2018-05-14 14:55 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14  3:15 [PATCH RFC 0/8] rcu fixes, clean ups for rcu/dev Joel Fernandes (Google)
2018-05-14  3:15 ` [PATCH RFC 1/8] rcu: Add comment documenting how rcu_seq_snap works Joel Fernandes (Google)
2018-05-14  3:47   ` Randy Dunlap
2018-05-14  5:05     ` Joel Fernandes
2018-05-14 17:38   ` Paul E. McKenney
2018-05-15  1:51     ` Joel Fernandes
2018-05-15  3:59       ` Paul E. McKenney
2018-05-15  7:02         ` Joel Fernandes
2018-05-15 12:55           ` Paul E. McKenney
2018-05-15 18:41             ` Joel Fernandes
2018-05-15 19:08               ` Paul E. McKenney
2018-05-15 22:55                 ` Joel Fernandes
2018-05-16 15:45                   ` Paul E. McKenney
2018-05-16 23:21                     ` Joel Fernandes
2018-05-14  3:15 ` [PATCH RFC 2/8] rcu: Clarify usage of cond_resched for tasks-RCU Joel Fernandes (Google)
2018-05-14 14:54   ` Steven Rostedt [this message]
2018-05-14 17:22     ` Paul E. McKenney
2018-05-15  0:35       ` Joel Fernandes
2018-05-15  3:42         ` Paul E. McKenney
2018-05-14  3:15 ` [PATCH RFC 3/8] rcu: Add back the cpuend tracepoint Joel Fernandes (Google)
2018-05-14 18:12   ` Paul E. McKenney
2018-05-15  0:43     ` Joel Fernandes
2018-05-14  3:15 ` [PATCH RFC 4/8] rcu: Get rid of old c variable from places in tree RCU Joel Fernandes (Google)
2018-05-14 17:57   ` Paul E. McKenney
2018-05-15  0:41     ` Joel Fernandes
2018-05-14  3:15 ` [PATCH RFC 5/8] rcu: Use rcu_node as temporary variable in funnel locking loop Joel Fernandes (Google)
2018-05-14 18:00   ` Paul E. McKenney
2018-05-15  0:43     ` Joel Fernandes
2018-05-14  3:15 ` [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint Joel Fernandes (Google)
2018-05-14 18:38   ` Paul E. McKenney
2018-05-15  0:57     ` Joel Fernandes
2018-05-15  3:46       ` Paul E. McKenney
2018-05-15 23:04         ` Joel Fernandes
2018-05-16 15:48           ` Paul E. McKenney
2018-05-16 23:13             ` Joel Fernandes
2018-05-14  3:15 ` [PATCH RFC 7/8] rcu: trace CleanupMore condition only if needed Joel Fernandes (Google)
2018-05-14 19:20   ` Paul E. McKenney
2018-05-15  1:01     ` Joel Fernandes
2018-05-15  3:47       ` Paul E. McKenney
2018-05-14  3:15 ` [PATCH RFC 8/8] rcu: Fix cpustart tracepoint gp_seq number Joel Fernandes (Google)
2018-05-14 20:33   ` Paul E. McKenney
2018-05-15  1:02     ` Joel Fernandes

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=20180514105454.45946ad3@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=byungchul.park@lge.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --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;
as well as URLs for NNTP newsgroup(s).