public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: linux-kernel@us.ibm.com
Cc: joe@perches.com, akpm@osdl.org, matthltc@us.ibm.com,
	dipankar@in.ibm.com, stern@rowland.harvard.edu, mingo@elte.hu,
	tytso@us.ibm.com, dvhltc@us.ibm.com, oleg@tv-sign.ru,
	jes@sgi.com
Subject: [PATCH] srcu-3: improved comment and code-style improvements from Joe Perches
Date: Fri, 7 Jul 2006 16:26:04 -0700	[thread overview]
Message-ID: <20060707232604.GA2784@us.ibm.com> (raw)

An improved comment for synchronize_srcu() and fixes for code-style
bugs pointed out by off-list by Joe Perches.

CC: Joe Perches <joe@perches.com>
Signed-off-by: Paul E. McKenney <paulmck@us.ibm.com>
---

 srcu.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff -urpNa -X dontdiff linux-2.6.17-srcu-LKML-3/kernel/srcu.c linux-2.6.17-srcu-LKML-4/kernel/srcu.c
--- linux-2.6.17-srcu-LKML-3/kernel/srcu.c	2006-07-06 16:45:01.000000000 -0700
+++ linux-2.6.17-srcu-LKML-4/kernel/srcu.c	2006-07-06 16:50:23.000000000 -0700
@@ -62,7 +62,7 @@ static int srcu_readers_active_idx(struc
 	sum = 0;
 	for_each_possible_cpu(cpu)
 		sum += per_cpu_ptr(sp->per_cpu_ref, cpu)->c[idx];
-	return (sum);
+	return sum;
 }
 
 /**
@@ -144,11 +144,15 @@ void srcu_read_unlock(struct srcu_struct
  * As with classic RCU, the updater must use some separate means of
  * synchronizing concurrent updates.  Can block; must be called from
  * process context.
+ *
+ * Note that it is illegal to call synchornize_srcu() from the corresponding
+ * SRCU read-side critical section; doing so will result in deadlock.
+ * However, it is perfectly legal to call synchronize_srcu() on one
+ * srcu_struct from some other srcu_struct's read-side critical section.
  */
 void synchronize_srcu(struct srcu_struct *sp)
 {
 	int idx;
-	int sum;
 
 	idx = sp->completed;
 	mutex_lock(&sp->mutex);
@@ -195,12 +199,8 @@ void synchronize_srcu(struct srcu_struct
 	 * will have finished executing.
 	 */
 
-	for (;;) {
-		sum = srcu_readers_active_idx(sp, idx);
-		if (sum == 0)
-			break;
+	while (srcu_readers_active_idx(sp, idx))
 		schedule_timeout_interruptible(1);
-	}
 
 	synchronize_sched();  /* Force memory barrier on all CPUs. */
 

                 reply	other threads:[~2006-07-07 23:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060707232604.GA2784@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=dipankar@in.ibm.com \
    --cc=dvhltc@us.ibm.com \
    --cc=jes@sgi.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@us.ibm.com \
    --cc=matthltc@us.ibm.com \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=stern@rowland.harvard.edu \
    --cc=tytso@us.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