From: Roland Dreier <rdreier@cisco.com>
To: "Vineet Gupta" <vineetg76@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Usage semantics of atomic_set ( )
Date: Fri, 11 Jan 2008 15:16:40 -0800 [thread overview]
Message-ID: <adahchk9cmf.fsf@cisco.com> (raw)
In-Reply-To: <9f4f8abe0801111457t7535069ar1f98cc37d5cf8d40@mail.gmail.com> (Vineet Gupta's message of "Fri, 11 Jan 2008 14:57:47 -0800")
> I'm trying to implement atomic ops for a CPU which has no inherent
> support for Read-Modify-Write Ops. Instead of using a global spin lock
> which protects all the atomic APIs, I want to use a spin lock per
> instance of atomic_t. This works well when atomic_t is unitary and
> statically initialized using ATOMIC_INIT (where I can reset the
> spinlock_t as well). However if atomic_t var is embedded within a
> bigger struct which is allocated dynamically how to I init the
> embedded spin lock. atomic_set ( ) is the closest choice, however I
> don't think it's current usage in kernel code qualifies it to be
> "initializer only".
A simple way to handle this might be to use a separate array of
spinlocks and hash each atomic_t to one entry in the array. You could
look in asm-parisc and arch/parisc to see an implementation of this
that is already in the kernel.
- R.
next prev parent reply other threads:[~2008-01-11 23:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-11 22:57 Usage semantics of atomic_set ( ) Vineet Gupta
2008-01-11 23:16 ` Roland Dreier [this message]
2008-01-12 1:37 ` Chris Snook
2008-01-12 18:36 ` Vineet Gupta
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=adahchk9cmf.fsf@cisco.com \
--to=rdreier@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vineetg76@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.