From: William Lee Irwin III <wli@holomorphy.com>
To: Andrew Morton <akpm@osdl.org>
Cc: oleg@tv-sign.ru, linux-kernel@vger.kernel.org
Subject: [4/4] eliminate inode waitqueue hashtable
Date: Sat, 28 Aug 2004 02:24:51 -0700 [thread overview]
Message-ID: <20040828092451.GL5492@holomorphy.com> (raw)
In-Reply-To: <20040828092337.GK5492@holomorphy.com>
On Sat, Aug 28, 2004 at 02:23:37AM -0700, William Lee Irwin III wrote:
> Eliminate the bh waitqueue hashtable using bit_waitqueue() via
> wait_on_bit() and wake_up_bit() to locate the waitqueue head associated
> with a bit.
Eliminate the inode waitqueue hashtable using bit_waitqueue() via
wait_on_bit() and wake_up_bit() to locate the waitqueue head associated
with a bit.
Index: mm1-2.6.9-rc1/fs/inode.c
===================================================================
--- mm1-2.6.9-rc1.orig/fs/inode.c 2004-08-26 15:04:02.000000000 -0700
+++ mm1-2.6.9-rc1/fs/inode.c 2004-08-27 22:15:43.602377440 -0700
@@ -1257,37 +1257,17 @@
#endif
-/*
- * Hashed waitqueues for wait_on_inode(). The table is pretty small - the
- * kernel doesn't lock many inodes at the same time.
- */
-#define I_WAIT_TABLE_ORDER 3
-static struct i_wait_queue_head {
- wait_queue_head_t wqh;
-} ____cacheline_aligned_in_smp i_wait_queue_heads[1<<I_WAIT_TABLE_ORDER];
+#define __I_LOCK 3
-/*
- * Return the address of the waitqueue_head to be used for this inode
- */
-static wait_queue_head_t *i_waitq_head(struct inode *inode)
+static int inode_wait(void *word)
{
- return &i_wait_queue_heads[hash_ptr(inode, I_WAIT_TABLE_ORDER)].wqh;
+ schedule();
+ return 0;
}
void __wait_on_inode(struct inode *inode)
{
- DECLARE_WAITQUEUE(wait, current);
- wait_queue_head_t *wq = i_waitq_head(inode);
-
- add_wait_queue(wq, &wait);
-repeat:
- set_current_state(TASK_UNINTERRUPTIBLE);
- if (inode->i_state & I_LOCK) {
- schedule();
- goto repeat;
- }
- remove_wait_queue(wq, &wait);
- __set_current_state(TASK_RUNNING);
+ wait_on_bit(&inode->i_state, __I_LOCK, inode_wait, TASK_UNINTERRUPTIBLE);
}
/*
@@ -1305,27 +1285,23 @@
*/
static void __wait_on_freeing_inode(struct inode *inode)
{
- DECLARE_WAITQUEUE(wait, current);
- wait_queue_head_t *wq = i_waitq_head(inode);
+ wait_queue_head_t *wq = bit_waitqueue(&inode->i_state, __I_LOCK);
+ DEFINE_WAIT_BIT(wait, &inode->i_state, __I_LOCK);
- add_wait_queue(wq, &wait);
- set_current_state(TASK_UNINTERRUPTIBLE);
+ prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE);
spin_unlock(&inode_lock);
schedule();
- remove_wait_queue(wq, &wait);
+ finish_wait(wq, &wait.wait);
spin_lock(&inode_lock);
}
void wake_up_inode(struct inode *inode)
{
- wait_queue_head_t *wq = i_waitq_head(inode);
-
/*
* Prevent speculative execution through spin_unlock(&inode_lock);
*/
smp_mb();
- if (waitqueue_active(wq))
- wake_up_all(wq);
+ wake_up_bit(&inode->i_state, __I_LOCK);
}
EXPORT_SYMBOL(wake_up_inode);
@@ -1361,11 +1337,6 @@
void __init inode_init(unsigned long mempages)
{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(i_wait_queue_heads); i++)
- init_waitqueue_head(&i_wait_queue_heads[i].wqh);
-
/* inode slab cache */
inode_cachep = kmem_cache_create("inode_cache", sizeof(struct inode),
0, SLAB_PANIC, init_once, NULL);
next prev parent reply other threads:[~2004-08-28 9:27 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-26 8:47 2.6.9-rc1-mm1 Andrew Morton
2004-08-26 11:07 ` 2.6.9-rc1-mm1 Con Kolivas
2004-08-26 14:28 ` 2.6.9-rc1-mm1 Jurriaan
2004-08-26 18:25 ` 2.6.9-rc1-mm1 Thomas Davis
2004-08-26 14:36 ` 2.6.9-rc1-mm1 Rafael J. Wysocki
2004-08-26 14:45 ` 2.6.9-rc1-mm1 Felipe Alfaro Solana
2004-08-26 15:35 ` 2.6.9-rc1-mm1 Rafael J. Wysocki
2004-08-26 16:38 ` 2.6.9-rc1-mm1 Con Kolivas
2004-08-26 20:36 ` 2.6.9-rc1-mm1 Rafael J. Wysocki
2004-08-26 20:55 ` 2.6.9-rc1-mm1 Martin J. Bligh
2004-08-26 23:19 ` 2.6.9-rc1-mm1 Con Kolivas
2004-08-26 23:43 ` 2.6.9-rc1-mm1 Martin J. Bligh
2004-08-27 0:37 ` 2.6.9-rc1-mm1 Nuno Silva
2004-08-27 0:46 ` 2.6.9-rc1-mm1 Con Kolivas
2004-08-27 0:51 ` 2.6.9-rc1-mm1 Martin J. Bligh
2004-08-27 0:55 ` 2.6.9-rc1-mm1 Con Kolivas
2004-08-27 0:58 ` 2.6.9-rc1-mm1 Rick Lindsley
2004-08-27 20:54 ` 2.6.9-rc1-mm1 Rafael J. Wysocki
2004-08-27 21:54 ` 2.6.9-rc1-mm1 Rick Lindsley
2004-08-27 22:29 ` 2.6.9-rc1-mm1 Rafael J. Wysocki
2004-09-03 21:11 ` schedstat-2.6.8.1 [was: Re: 2.6.9-rc1-mm1] Rafael J. Wysocki
2004-09-08 7:09 ` Rick Lindsley
2004-09-04 18:35 ` 2.6.9-rc1-mm1 Rafael J. Wysocki
2004-09-08 8:10 ` 2.6.9-rc1-mm1 Rick Lindsley
2004-09-04 23:10 ` latency.c [was: Re: 2.6.9-rc1-mm1] Rafael J. Wysocki
2004-09-08 8:12 ` Rick Lindsley
2004-09-08 12:02 ` Rafael J. Wysocki
2004-08-26 20:51 ` 2.6.9-rc1-mm1 Martin J. Bligh
2004-08-27 1:43 ` 2.6.9-rc1-mm1 Nick Piggin
2004-08-26 12:06 ` 2.6.9-rc1-mm1 Denis Vlasenko
2004-08-26 19:40 ` 2.6.9-rc1-mm1 Sam Ravnborg
2004-08-26 17:58 ` 2.6.9-rc1-mm1 (compile stats) John Cherry
2004-08-26 18:53 ` 2.6.9-rc1-mm1 - undefined references - [PATCH] Paolo Ornati
2004-08-28 8:54 ` Adrian Bunk
2004-08-28 9:45 ` Paolo Ornati
2004-08-26 22:46 ` 2.6.9-rc1-mm1 Rafael J. Wysocki
2004-08-26 22:50 ` 2.6.9-rc1-mm1 Andrew Morton
2004-08-26 23:53 ` 2.6.9-rc1-mm1 Tomasz Torcz
[not found] ` <20040827043132.GJ2793@holomorphy.com>
2004-08-27 21:42 ` 2.6.9-rc1-mm1 William Lee Irwin III
2004-08-28 5:26 ` [0/4] standardized waitqueue hashing William Lee Irwin III
2004-08-28 5:31 ` [1/4] standardize bit waiting data type William Lee Irwin III
2004-08-28 5:35 ` [2/4] consolidate bit waiting code patterns William Lee Irwin III
2004-08-28 5:37 ` [3/4] eliminate bh waitqueue hashtable William Lee Irwin III
2004-08-28 5:38 ` [4/4] eliminate inode " William Lee Irwin III
2004-08-28 6:17 ` [1/4] standardize bit waiting data type Andrew Morton
2004-08-28 6:34 ` William Lee Irwin III
2004-08-28 6:40 ` Andrew Morton
2004-08-28 6:48 ` William Lee Irwin III
2004-08-28 9:20 ` William Lee Irwin III
2004-08-28 9:22 ` [2/4] consolidate bit waiting code patterns William Lee Irwin III
2004-08-28 9:23 ` [3/4] eliminate bh waitqueue hashtable William Lee Irwin III
2004-08-28 9:24 ` William Lee Irwin III [this message]
2004-08-28 9:43 ` Andrew Morton
2004-08-28 9:34 ` [2/4] consolidate bit waiting code patterns Andrew Morton
2004-08-28 9:51 ` William Lee Irwin III
2004-08-28 9:39 ` Andrew Morton
2004-08-28 9:51 ` William Lee Irwin III
2004-08-28 9:18 ` [1/4] standardize bit waiting data type Christoph Hellwig
2004-08-28 9:20 ` William Lee Irwin III
2004-08-28 9:06 ` [patch] 2.6.9-rc1-mm1: megaraid_mbox.c compile error with gcc 3.4 Adrian Bunk
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=20040828092451.GL5492@holomorphy.com \
--to=wli@holomorphy.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
/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