From: Oleg Nesterov <oleg@tv-sign.ru>
To: Nick Piggin <npiggin@suse.de>,
Ravikiran G Thirumalai <kiran@scalex86.org>,
Ingo Molnar <mingo@elte.hu>,
Nikita Danilov <nikita@clusterfs.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [patch] queued spinlocks (i386)
Date: Sun, 25 Mar 2007 19:54:07 +0400 [thread overview]
Message-ID: <20070325155407.GA497@tv-sign.ru> (raw)
I am sorry for being completely off-topic, but I've been wondering for the
long time...
What if we replace raw_spinlock_t.slock with "struct task_struct *owner" ?
void _spin_lock(spinlock_t *lock)
{
struct task_struct *owner;
for (;;) {
preempt_disable();
if (likely(_raw_spin_trylock(lock)))
break;
preempt_enable();
while (!spin_can_lock(lock)) {
rcu_read_lock();
owner = lock->owner;
if (owner && current->prio < owner->prio &&
!test_tsk_thread_flag(owner, TIF_NEED_RESCHED))
set_tsk_thread_flag(owner, TIF_NEED_RESCHED);
rcu_read_unlock();
cpu_relax();
}
}
lock->owner = current;
}
void _spin_unlock(spinlock_t *lock)
{
lock->owner = NULL;
_raw_spin_unlock(lock);
preempt_enable();
}
Now we don't need need_lockbreak(lock), need_resched() is enough, and we take
->prio into consideration.
Makes sense? Or stupid?
Oleg.
next reply other threads:[~2007-03-25 16:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-25 15:54 Oleg Nesterov [this message]
2007-03-27 15:22 ` [patch] queued spinlocks (i386) Andi Kleen
2007-03-28 7:04 ` Nick Piggin
2007-03-29 18:42 ` Oleg Nesterov
2007-03-29 22:16 ` Davide Libenzi
2007-03-30 2:06 ` Lee Revell
2007-03-30 2:17 ` Nick Piggin
2007-03-30 4:44 ` Lee Revell
2007-03-30 1:53 ` Nick Piggin
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=20070325155407.GA497@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=kiran@scalex86.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nikita@clusterfs.com \
--cc=npiggin@suse.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