netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Tom Tucker <tom@opengridcomputing.com>
Cc: Andrew Morton <akpm@osdl.org>,
	Steve Wise <swise@opengridcomputing.com>,
	rdreier@cisco.com, mshefty@ichips.intel.com,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	openib-general@openib.org
Subject: Re: [PATCH v2 4/7] AMSO1100 Memory Management.
Date: Sat, 17 Jun 2006 13:59:12 +1000	[thread overview]
Message-ID: <44937E10.3000006@yahoo.com.au> (raw)
In-Reply-To: <1150128349.22704.20.camel@trinity.ogc.int>

Tom Tucker wrote:
> On Thu, 2006-06-08 at 01:17 -0700, Andrew Morton wrote:
> 
>>On Wed, 07 Jun 2006 15:06:55 -0500
>>Steve Wise <swise@opengridcomputing.com> wrote:
>>
>>
>>>+void c2_free(struct c2_alloc *alloc, u32 obj)
>>>+{
>>>+	spin_lock(&alloc->lock);
>>>+	clear_bit(obj, alloc->table);
>>>+	spin_unlock(&alloc->lock);
>>>+}
>>
>>The spinlock is unneeded here.
> 
> 
> Good point.

Really?

clear_bit does not give you any memory ordering, so you can have
the situation where another CPU sees the bit cleared, but this
CPU still has stores pending to whatever it is being freed. Or
any number of other nasty memory ordering badness.

I'd just use the spinlocks, and prepend the clear_bit with a
double underscore (so you get the non-atomic version), if that
is appropriate.

The spinlocks nicely handle all the memory ordering issues, and
serve to document concurrency issues. If you need every last bit
of performance and scalability, that's OK, but you need comments
and I suspect you'd need more memory barriers.

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

  parent reply	other threads:[~2006-06-17  3:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-07 20:06 [PATCH v2 0/7][RFC] Ammasso 1100 iWARP Driver Steve Wise
2006-06-07 20:06 ` [PATCH v2 1/7] AMSO1100 Low Level Driver Steve Wise
2006-06-07 20:06 ` [PATCH v2 2/7] AMSO1100 WR / Event Definitions Steve Wise
2006-06-07 20:06 ` [PATCH v2 3/7] AMSO1100 OpenFabrics Provider Steve Wise
2006-06-07 20:06 ` [PATCH v2 4/7] AMSO1100 Memory Management Steve Wise
2006-06-08  8:17   ` Andrew Morton
2006-06-12 16:05     ` Tom Tucker
2006-06-16 14:20       ` Steve Wise
2006-06-17  3:59       ` Nick Piggin [this message]
2006-06-07 20:06 ` [PATCH v2 5/7] AMSO1100 Message Queues Steve Wise
2006-06-07 20:07 ` [PATCH v2 6/7] AMSO1100: Privileged Verbs Queues Steve Wise
2006-06-07 20:07 ` [PATCH v2 7/7] AMSO1100 Makefiles and Kconfig changes Steve Wise
2006-06-07 20:39 ` [PATCH v2 2/7] AMSO1100 WR / Event Definitions Steve Wise
2006-06-07 20:43   ` Roland Dreier
2006-06-07 20:59     ` Steve Wise

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=44937E10.3000006@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mshefty@ichips.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=openib-general@openib.org \
    --cc=rdreier@cisco.com \
    --cc=swise@opengridcomputing.com \
    --cc=tom@opengridcomputing.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;
as well as URLs for NNTP newsgroup(s).