From: "Milind Arun Choudhary" <milindchoudhary@gmail.com>
To: "Matthew Wilcox" <matthew@wil.cx>
Cc: "Robert P. J. Day" <rpjday@mindspring.com>,
kernelnewbies@nl.linux.org, kernel-janitors@lists.osdl.org,
"Roland Dreier" <rdreier@cisco.com>,
"Jan Engelhardt" <jengelh@linux01.gwdg.de>,
linux-kernel@vger.kernel.org
Subject: Re: [KJ] remove SPIN_LOCK_UNLOCKED
Date: Wed, 11 Apr 2007 09:39:16 +0530 [thread overview]
Message-ID: <3b44d3fb0704102109g380bbb04v3579a94e1b6dabe1@mail.gmail.com> (raw)
In-Reply-To: <20070410220804.GI26692@parisc-linux.org>
On 4/11/07, Matthew Wilcox <matthew@wil.cx> wrote:
> On Tue, Apr 10, 2007 at 05:45:07PM -0400, Robert P. J. Day wrote:
> > that works fine if you're defining a single spinlock, but what do you
> > do in cases like this:
> >
> > arch/sparc/lib/atomic32.c: [0 ... (ATOMIC_HASH_SIZE-1)] = SPIN_LOCK_UNLOCKED
> >
> > that is, when you're assigning an array of them? you still need some
> > kind of generic, unnamed spinlock in those circumstances, no?
>
> That's a special case for architecture-only code. It's not to be used
> by drivers.
as per my understanding, [which i should have keyed in earlier]
different places where SPIN_LOCK_UNLOCKED currently appears are
1. static spinlock_t foobar = SPIN_LOCK_UNLOCKED;
needs to be replaced bye DEFINE_SPINLOCK
e.g linux-core/drm_memory_debug.h
-static spinlock_t drm_mem_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(drm_mem_lock);
there are very few occurrences left in the tree i see
2. allocating a data structure dynamically
& initializing the spinlock embedded within
use spin_lock_init()
e.g linux-core/via_dmablit.c
- blitq->blit_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&blitq->blit_lock);
3. static initialization of structure members
struct foo bar ={
.
.
.
.lock = SPIN_LOCK_UNLOCKED,
.
}
use
struct foo bar ={
.
.
.
.lock = __SPIN_LOCK_UNLOCKED(bar.lock),
.
}
e.g arch/i386/kernel/traps.c
- .lock = SPIN_LOCK_UNLOCKED,
+ .lock = __SPIN_LOCK_UNLOCKED(die.lock),
plenty of these are still there
may be some patches queued
4. arrays of spinlocks
e.g arch/cris/arch-v32/kernel/smp.c
-spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] =
SPIN_LOCK_UNLOCKED};
+raw_spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] =
__RAW_SPIN_LOCK_UNLOCKED};
my question is still there in the original post
about spin_lock_init()
CMIIW
Refer:
http://lkml.org/lkml/2005/6/20/47
http://lkml.org/lkml/2007/1/16/90
http://lists.openwall.net/linux-kernel/2007/02/01/258
--
Milind Arun Choudhary
next prev parent reply other threads:[~2007-04-11 4:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-10 18:16 [KJ]remove SPIN_LOCK_UNLOCKED Milind Arun Choudhary
2007-04-10 20:50 ` Jan Engelhardt
2007-04-10 21:13 ` Roland Dreier
2007-04-10 21:25 ` Robert P. J. Day
2007-04-10 21:28 ` Jan Engelhardt
2007-04-10 21:42 ` Roland Dreier
2007-04-10 21:45 ` Robert P. J. Day
2007-04-10 21:58 ` Roland Dreier
2007-04-10 22:08 ` [KJ] remove SPIN_LOCK_UNLOCKED Matthew Wilcox
2007-04-11 4:09 ` Milind Arun Choudhary [this message]
2007-04-11 5:47 ` Robert P. J. Day
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=3b44d3fb0704102109g380bbb04v3579a94e1b6dabe1@mail.gmail.com \
--to=milindchoudhary@gmail.com \
--cc=jengelh@linux01.gwdg.de \
--cc=kernel-janitors@lists.osdl.org \
--cc=kernelnewbies@nl.linux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=rdreier@cisco.com \
--cc=rpjday@mindspring.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
all inboxes | Powered by JetHome®