All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zoltan Menyhart <Zoltan.Menyhart@bull.net>
To: Christoph Lameter <clameter@sgi.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
	"Boehm, Hans" <hans.boehm@hp.com>,
	"Grundler, Grant G" <grant.grundler@hp.com>,
	"Chen, Kenneth W" <kenneth.w.chen@intel.com>,
	akpm@osdl.org, linux-kernel@vger.kernel.org,
	linux-ia64@vger.kernel.org
Subject: Re: Fix unlock_buffer() to work the same way as bit_unlock()
Date: Thu, 30 Mar 2006 08:43:22 +0000	[thread overview]
Message-ID: <442B9A2A.7000306@bull.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0603291529160.26011@schroedinger.engr.sgi.com>

Christoph Lameter wrote:
> Hmmm... Maybe we therefore need to add a mode to each bit operation in 
> the kernel?
> 
> With that we can also get rid of the __* version of bitops.
> 
> Possible modes are
> 
> NON_ATOMIC 	Do not perform any atomic ops at all.
> 
> ATOMIC		Atomic but unordered
> 
> ACQUIRE		Atomic with acquire semantics (or lock semantics)
> 
> RELEASE 	Atomic with release semantics (or unlock semantics)
> 
> FENCE		Atomic with full fence.
> 
> This would require another bitops overhaul.
> 
> Maybe we can preserve the existing code with bitops like __* mapped to 
> *(..., NON_ATOMIC) and * mapped to *(..., FENCE) and the gradually fix the 
> rest of the kernel.

Form semantical point of view, the forms:

	bit_foo(..., mode)
and
	bit_foo_mode(...)

are equivalent.

However, I do not think your implementation would be efficient due to
selecting the ordering mode at run time:

> +	switch (mode) {
> +	case MODE_NONE :
> +	case MODE_ACQUIRE :
> +		return cmpxchg_acq(m, old, new);
> +	case MODE_FENCE :
> +		smp_mb();
> +		/* Fall through */
> +	case MODE_RELEASE :
> +		return cmpxchg_rel(m, old, new);

> +	if (mode = ORDER_NON_ATOMIC) {
> +		*m |= bit;
> +		return;
> +	}

etc.

In addition, we may want to inline these primitives...

A compile-time selection of the appropriate code sequence would help.

Thanks,

Zoltan

WARNING: multiple messages have this Message-ID (diff)
From: Zoltan Menyhart <Zoltan.Menyhart@bull.net>
To: Christoph Lameter <clameter@sgi.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
	"Boehm, Hans" <hans.boehm@hp.com>,
	"Grundler, Grant G" <grant.grundler@hp.com>,
	"Chen, Kenneth W" <kenneth.w.chen@intel.com>,
	akpm@osdl.org, linux-kernel@vger.kernel.org,
	linux-ia64@vger.kernel.org
Subject: Re: Fix unlock_buffer() to work the same way as bit_unlock()
Date: Thu, 30 Mar 2006 10:43:22 +0200	[thread overview]
Message-ID: <442B9A2A.7000306@bull.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0603291529160.26011@schroedinger.engr.sgi.com>

Christoph Lameter wrote:
> Hmmm... Maybe we therefore need to add a mode to each bit operation in 
> the kernel?
> 
> With that we can also get rid of the __* version of bitops.
> 
> Possible modes are
> 
> NON_ATOMIC 	Do not perform any atomic ops at all.
> 
> ATOMIC		Atomic but unordered
> 
> ACQUIRE		Atomic with acquire semantics (or lock semantics)
> 
> RELEASE 	Atomic with release semantics (or unlock semantics)
> 
> FENCE		Atomic with full fence.
> 
> This would require another bitops overhaul.
> 
> Maybe we can preserve the existing code with bitops like __* mapped to 
> *(..., NON_ATOMIC) and * mapped to *(..., FENCE) and the gradually fix the 
> rest of the kernel.

Form semantical point of view, the forms:

	bit_foo(..., mode)
and
	bit_foo_mode(...)

are equivalent.

However, I do not think your implementation would be efficient due to
selecting the ordering mode at run time:

> +	switch (mode) {
> +	case MODE_NONE :
> +	case MODE_ACQUIRE :
> +		return cmpxchg_acq(m, old, new);
> +	case MODE_FENCE :
> +		smp_mb();
> +		/* Fall through */
> +	case MODE_RELEASE :
> +		return cmpxchg_rel(m, old, new);

> +	if (mode == ORDER_NON_ATOMIC) {
> +		*m |= bit;
> +		return;
> +	}

etc.

In addition, we may want to inline these primitives...

A compile-time selection of the appropriate code sequence would help.

Thanks,

Zoltan

  reply	other threads:[~2006-03-30  8:43 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-28  3:59 Fix unlock_buffer() to work the same way as bit_unlock() Christoph Lameter
2006-03-28  3:59 ` Christoph Lameter
2006-03-28  8:10 ` Nick Piggin
2006-03-28  8:10   ` Nick Piggin
2006-03-28 18:53 ` Chen, Kenneth W
2006-03-28 18:53   ` Chen, Kenneth W
2006-03-28 21:42   ` Zoltan Menyhart
2006-03-28 21:42     ` Zoltan Menyhart
2006-03-28 23:48     ` Christoph Lameter
2006-03-28 23:48       ` Christoph Lameter
2006-03-29  0:07       ` Nick Piggin
2006-03-29  0:07         ` Nick Piggin
2006-03-29  2:23         ` Christoph Lameter
2006-03-29  2:23           ` Christoph Lameter
2006-03-29  2:35           ` Nick Piggin
2006-03-29  2:35             ` Nick Piggin
2006-03-29 10:57       ` Zoltan Menyhart
2006-03-29 10:57         ` Zoltan Menyhart
2006-03-29  0:12 ` Chen, Kenneth W
2006-03-29  0:12   ` Chen, Kenneth W
2006-03-29  0:27 ` Chen, Kenneth W
2006-03-29  0:27   ` Chen, Kenneth W
2006-03-29  0:47   ` Christoph Lameter
2006-03-29  0:47     ` Christoph Lameter
2006-03-29  1:39 ` Chen, Kenneth W
2006-03-29  1:39   ` Chen, Kenneth W
2006-03-29 12:16   ` Zoltan Menyhart
2006-03-29 12:16     ` Zoltan Menyhart
2006-03-30  1:56     ` Nick Piggin
2006-03-30  1:56       ` Nick Piggin
2006-03-29  6:46 ` Chen, Kenneth W
2006-03-29  6:46   ` Chen, Kenneth W
2006-03-29  7:11   ` Christoph Lameter
2006-03-29  7:11     ` Christoph Lameter
2006-03-30  1:34   ` Nick Piggin
2006-03-30  1:34     ` Nick Piggin
2006-03-29  6:50 ` Chen, Kenneth W
2006-03-29  6:50   ` Chen, Kenneth W
2006-03-30  1:36   ` Nick Piggin
2006-03-30  1:36     ` Nick Piggin
2006-03-29 18:33 ` Boehm, Hans
2006-03-29 18:33   ` Boehm, Hans
2006-03-29 19:11   ` Grant Grundler
2006-03-29 19:11     ` Grant Grundler
2006-03-29 19:31 ` Boehm, Hans
2006-03-29 19:31   ` Boehm, Hans
2006-03-29 22:17   ` Christoph Lameter
2006-03-29 22:17     ` Christoph Lameter
2006-03-29 22:56 ` Boehm, Hans
2006-03-29 22:56   ` Boehm, Hans
2006-03-29 23:33   ` Christoph Lameter
2006-03-29 23:33     ` Christoph Lameter
2006-03-30  8:43     ` Zoltan Menyhart [this message]
2006-03-30  8:43       ` Zoltan Menyhart
2006-03-30  8:55       ` Nick Piggin
2006-03-30  8:55         ` Nick Piggin
2006-03-30 19:11         ` Christoph Lameter
2006-03-30 19:11           ` Christoph Lameter
2006-03-30 17:17       ` Christoph Lameter
2006-03-30 17:17         ` Christoph Lameter
2006-03-29 23:49 ` Chen, Kenneth W
2006-03-29 23:49   ` Chen, Kenneth W
2006-03-29 23:50   ` Christoph Lameter
2006-03-29 23:50     ` Christoph Lameter
2006-03-29 23:50   ` Grant Grundler
2006-03-29 23:50     ` Grant Grundler
     [not found] ` <442AA13B.3050104@bull.net>
2006-03-30  1:57   ` Nick Piggin
2006-03-30  1:57     ` Nick Piggin
2006-03-30 17:57 ` Boehm, Hans
2006-03-30 17:57   ` Boehm, Hans
2006-03-30 18:17   ` Christoph Lameter
2006-03-30 18:17     ` Christoph Lameter
2006-03-30 22:17 ` Boehm, Hans
2006-03-30 22:26 ` Boehm, Hans
2006-03-30 22:26   ` Boehm, Hans

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=442B9A2A.7000306@bull.net \
    --to=zoltan.menyhart@bull.net \
    --cc=akpm@osdl.org \
    --cc=clameter@sgi.com \
    --cc=grant.grundler@hp.com \
    --cc=hans.boehm@hp.com \
    --cc=kenneth.w.chen@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    /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.