mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Darren Hart <dvhltc@us.ibm.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@elte.hu>,
	Esben Nielsen <nielsen.esben@googlemail.com>
Subject: [RFC, PATCH -rt] futex_atomic_cmpxchg_inatomic usage
Date: Wed, 2 Aug 2006 20:35:25 -0700	[thread overview]
Message-ID: <200608022035.26542.dvhltc@us.ibm.com> (raw)

While reviewing futex.c re Esben's rt_mutex_next_owner() serialization
posting, I had a question regarding the use of

futex_atomic_cmpxchg_inatomic()

In all but two places in futex.c we wrap that call with 
(inc|dec)_preempt_count() calls.  Nothing stood out to me that would
account for the difference.  Can some comment on why we don't have to
wrap the call in those two places (see patch for locations).  Just in 
case this happens to be a bug, I've included a patch to fix it.


Index: 2.6.17-rt8/kernel/futex.c
===================================================================
--- 2.6.17-rt8.orig/kernel/futex.c	2006-08-02 20:29:08.000000000 -0700
+++ 2.6.17-rt8/kernel/futex.c	2006-08-02 20:29:42.000000000 -0700
@@ -1303,8 +1303,10 @@
 		ret = get_user(uval, uaddr);
 		while (!ret) {
 			newval = (uval & FUTEX_OWNER_DIED) | newtid;
+			inc_preempt_count();
 			curval = futex_atomic_cmpxchg_inatomic(uaddr,
 							       uval, newval);
+			dec_preempt_count();
 			if (curval == -EFAULT)
 				ret = -EFAULT;
 			if (curval == uval)
@@ -1684,8 +1686,11 @@
 		 * thread-death.) The rest of the cleanup is done in
 		 * userspace.
 		 */
+		inc_preempt_count();
 		nval = futex_atomic_cmpxchg_inatomic(uaddr, uval,
 						     uval | FUTEX_OWNER_DIED);
+		dec_preempt_count();
+
 		if (nval == -EFAULT)
 			return -1;
-- 
Thanks,
 
Darren Hart
IBM Linux Technology Center
Realtime Linux Team

                 reply	other threads:[~2006-08-03  3:35 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=200608022035.26542.dvhltc@us.ibm.com \
    --to=dvhltc@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nielsen.esben@googlemail.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome