Re: 2.6.14-rc3-rt2

From: Steven Rostedt
Date: Fri Oct 07 2005 - 07:38:55 EST



On Fri, 7 Oct 2005, Ingo Molnar wrote:
>
> * Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> > I was compiling a kernel in a shell that I set to a priority of 20,
> > and it locked up on the bit_spin_lock crap of jbd. Did you want me to
> > send you that patch again that adds another spinlock to the buffer
> > head and uses that instead of the bit_spins?
>
> yeah, please do.
>

OK, here it is. I tested it out by doing what locked up the first time.
Compiling the kernel under a shell with a priority of 20.

It survived a "make clean; make -j2".

-- Steve

patched against 2.6.14-rc3-rt10

Index: linux-rt-quilt/fs/buffer.c
===================================================================
--- linux-rt-quilt.orig/fs/buffer.c 2005-10-06 08:04:55.000000000 -0400
+++ linux-rt-quilt/fs/buffer.c 2005-10-07 07:46:25.000000000 -0400
@@ -3055,6 +3055,7 @@
{
BUG_ON(!list_empty(&bh->b_assoc_buffers));
BUG_ON(spin_is_locked(&bh->b_uptodate_lock));
+ BUG_ON(spin_is_locked(&bh->b_state_lock));
kmem_cache_free(bh_cachep, bh);
get_cpu_var(bh_accounting).nr--;
recalc_bh_state();
@@ -3072,6 +3073,7 @@
memset(bh, 0, sizeof(*bh));
INIT_LIST_HEAD(&bh->b_assoc_buffers);
spin_lock_init(&bh->b_uptodate_lock);
+ spin_lock_init(&bh->b_state_lock);
}
}

Index: linux-rt-quilt/include/linux/buffer_head.h
===================================================================
--- linux-rt-quilt.orig/include/linux/buffer_head.h 2005-10-06 08:04:56.000000000 -0400
+++ linux-rt-quilt/include/linux/buffer_head.h 2005-10-07 07:46:25.000000000 -0400
@@ -62,6 +62,7 @@
void *b_private; /* reserved for b_end_io */
struct list_head b_assoc_buffers; /* associated with another mapping */
spinlock_t b_uptodate_lock;
+ spinlock_t b_state_lock;
};

/*
Index: linux-rt-quilt/include/linux/jbd.h
===================================================================
--- linux-rt-quilt.orig/include/linux/jbd.h 2005-10-06 08:04:00.000000000 -0400
+++ linux-rt-quilt/include/linux/jbd.h 2005-10-07 07:46:25.000000000 -0400
@@ -327,32 +327,32 @@

static inline void jbd_lock_bh_state(struct buffer_head *bh)
{
- bit_spin_lock(BH_State, &bh->b_state);
+ spin_lock(&bh->b_state_lock);
}

static inline int jbd_trylock_bh_state(struct buffer_head *bh)
{
- return bit_spin_trylock(BH_State, &bh->b_state);
+ return spin_trylock(&bh->b_state_lock);
}

static inline int jbd_is_locked_bh_state(struct buffer_head *bh)
{
- return bit_spin_is_locked(BH_State, &bh->b_state);
+ return spin_is_locked(&bh->b_state_lock);
}

static inline void jbd_unlock_bh_state(struct buffer_head *bh)
{
- bit_spin_unlock(BH_State, &bh->b_state);
+ spin_unlock(&bh->b_state_lock);
}

static inline void jbd_lock_bh_journal_head(struct buffer_head *bh)
{
- bit_spin_lock(BH_JournalHead, &bh->b_state);
+ spin_lock(&bh->b_uptodate_lock);
}

static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
{
- bit_spin_unlock(BH_JournalHead, &bh->b_state);
+ spin_unlock(&bh->b_uptodate_lock);
}

struct jbd_revoke_table_s;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/