From: Thomas Gleixner <tglx@linutronix.de>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Clark Williams <clark.williams@gmail.com>,
Gregory Haskins <ghaskins@novell.com>,
Linux-rt <linux-rt-users@vger.kernel.org>
Subject: Re: [patch 4/7] rtmutex: unify state manipulation
Date: Fri, 19 Dec 2008 20:40:17 +0100 (CET) [thread overview]
Message-ID: <alpine.LFD.2.00.0812192031270.3376@localhost.localdomain> (raw)
In-Reply-To: <alpine.DEB.1.10.0812191309540.26432@gandalf.stny.rr.com>
On Fri, 19 Dec 2008, Steven Rostedt wrote:
> > + } while (cmpxchg(¤t->state, state, block_state) != state);
>
> Doesn't this break archs that do not have cmpxchg?
We can use xchg. The waiter is protected against the RUNNING_MUTEX
state change via the mutex->lock. It's just some overcautioness when I
started to fix this.
> There might be another way. We could just use your TASK_RUNNING_MUTEX or
> trick for both mutexes and spinlocks.
The mechanisms should be the same for everything now.
> > - if (mtx)
> > - set_current_state(TASK_RUNNING);
> > - else {
> > - state = xchg(¤t->state, saved_state);
> > - if (unlikely(state == TASK_RUNNING))
> > - current->state = TASK_RUNNING;
> > - }
> > + rt_restore_current_state(saved_state);
>
> This is a bug. A mutex always leaves in the TASK_RUNNING state.
Duh, yes. So this should be:
rt_restore_current_state(!mtx ? saved_state : TASK_RUNNING);
> What about having the locking spinlocks and mutexes be almost identical.
> Like the rwlocks are (rwlocks and rwsems share the same code). We can use
> the RT_MUTEX_RUNNING trick for both. The only difference is that a mutex
> will always leave in the TASK_RUNNING state.
Good point.
Thanks,
tglx
next prev parent reply other threads:[~2008-12-19 19:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-19 16:02 [patch 0/7] 2.6.24.7-rt24 bugfixes Thomas Gleixner
2008-12-19 16:02 ` [patch 1/7] ftrace: fix task state printout Thomas Gleixner
2008-12-19 16:25 ` Frédéric Weisbecker
2008-12-19 21:36 ` Ingo Molnar
2008-12-19 21:40 ` Thomas Gleixner
2008-12-20 13:08 ` Frédéric Weisbecker
2008-12-19 16:02 ` [patch 2/7] sched: remove useless nointeractive state Thomas Gleixner
2008-12-19 16:02 ` [patch 3/7] rtmutex: remove unused variable Thomas Gleixner
2008-12-19 16:03 ` [patch 4/7] rtmutex: unify state manipulation Thomas Gleixner
2008-12-19 18:36 ` Steven Rostedt
2008-12-19 19:40 ` Thomas Gleixner [this message]
2008-12-19 16:03 ` [patch 5/7] rtmutex: remove uber optimization Thomas Gleixner
2008-12-19 16:03 ` [patch 6/7] rtmutex: remove useless schedule enforcement Thomas Gleixner
2008-12-19 16:03 ` [patch 7/7] rtmutex: prevent missed wakeups Thomas Gleixner
2008-12-19 21:22 [patch 0/7] 2.6.24.7-rt24 bugfixes V2 Thomas Gleixner
2008-12-19 21:22 ` [patch 4/7] rtmutex: unify state manipulation Thomas Gleixner
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=alpine.LFD.2.00.0812192031270.3376@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=clark.williams@gmail.com \
--cc=ghaskins@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/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®