All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Eric Valette <eric.valette@free.fr>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [3/2] document wake_up_bit()'s requirement for preceding memory barriers
Date: Tue, 31 Aug 2004 14:12:34 -0700	[thread overview]
Message-ID: <20040831211234.GV5492@holomorphy.com> (raw)
In-Reply-To: <20040831210542.GU5492@holomorphy.com>

On Tue, Aug 31, 2004 at 02:05:42PM -0700, William Lee Irwin III wrote:
> Some of the parameters to __wait_on_bit() and __wait_on_bit_lock() are
> redundant, as the wait_bit_queue parameter holds the flags word and the
> bit number. This patch updates __wait_on_bit() and __wait_on_bit_lock()
> to fetch that information from the wait_bit_queue passed to them and so
> reduce the number of parameters so that -mregparm may be more effective.
> Incremental atop the complete out-of-lining of the contention cases and
> the fastcall and wait_on_bit_lock()/test_and_set_bit() fixes.
> Successfully tested on x86-64.

Document the requirement to use a memory barrier prior to wake_up_bit().


Index: mm2-2.6.9-rc1/kernel/wait.c
===================================================================
--- mm2-2.6.9-rc1.orig/kernel/wait.c	2004-08-31 02:00:10.000000000 -0700
+++ mm2-2.6.9-rc1/kernel/wait.c	2004-08-31 14:07:13.688481360 -0700
@@ -219,6 +219,13 @@
  * is the part of the hashtable's accessor API that wakes up waiters
  * on a bit. For instance, if one were to have waiters on a bitflag,
  * one would call wake_up_bit() after clearing the bit.
+ *
+ * In order for this to function properly, as it uses waitqueue_active()
+ * internally, some kind of memory barrier must be done prior to calling
+ * this. Typically, this will be smp_mb__after_clear_bit(), but in some
+ * cases where bitflags are manipulated non-atomically under a lock, one
+ * may need to use a less regular barrier, such fs/inode.c's smp_mb(),
+ * because spin_unlock() does not guarantee a memory barrier.
  */
 void fastcall wake_up_bit(void *word, int bit)
 {

  reply	other threads:[~2004-08-31 21:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-31  8:05 2.6.9-rc1-mm2 : compilation error in kernel/wait.c Eric Valette
2004-08-31  8:09 ` William Lee Irwin III
2004-08-31  8:14   ` William Lee Irwin III
2004-08-31  8:44     ` wait_on_bit_lock() must test_and_set_bit(), not test_bit() William Lee Irwin III
2004-08-31 21:03       ` [1/2] move wait ops' contention case completely out of line William Lee Irwin III
2004-08-31 21:05         ` [2/2] reduce number of parameters to __wait_on_bit() and __wait_on_bit_lock() William Lee Irwin III
2004-08-31 21:12           ` William Lee Irwin III [this message]
2004-08-31  8:13 ` 2.6.9-rc1-mm2 : compilation error in kernel/wait.c Andrew Morton

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=20040831211234.GV5492@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=akpm@osdl.org \
    --cc=eric.valette@free.fr \
    --cc=linux-kernel@vger.kernel.org \
    /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.