Ingo,
Here's a conversion of the bit_spin_locks to wait_on_bit.
Unfortunately, this doesn't have PI but it is better than just a normal
bit_spin_lock.
This patch applies cleanly to 2.6.13-rc3 (that's what I tried it on). I
haven't done any benchmarking and I only booted this on a RT UP machine
so far. The RT part uses this portion.
So Stephen, please take a look and let me know if this is something
that is suitable for the mainline?
Thanks,
-- Steve
Signed-off-by: Steven Rostedt <[email protected]>
Index: linux_realtime_ernie/include/linux/jbd.h
===================================================================
--- linux_realtime_ernie/include/linux/jbd.h (revision 266)
+++ linux_realtime_ernie/include/linux/jbd.h (working copy)
@@ -324,36 +324,88 @@
return bh->b_private;
}
+#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT)
+
+extern int jbd_lock_bh_sleep(void *notused);
+
static inline void jbd_lock_bh_state(struct buffer_head *bh)
{
- bit_spin_lock(BH_State, &bh->b_state);
+ wait_on_bit_lock(&bh->b_state,BH_State,&jbd_lock_bh_sleep,
+ TASK_UNINTERRUPTIBLE);
+ __acquire(bitlock);
}
static inline int jbd_trylock_bh_state(struct buffer_head *bh)
{
- return bit_spin_trylock(BH_State, &bh->b_state);
+ if (test_and_set_bit(BH_State, &bh->b_state))
+ return 0;
+ __acquire(bitlock);
+ return 1;
}
static inline int jbd_is_locked_bh_state(struct buffer_head *bh)
{
- return bit_spin_is_locked(BH_State, &bh->b_state);
+ return test_bit(BH_State, &bh->b_state);
}
static inline void jbd_unlock_bh_state(struct buffer_head *bh)
{
- bit_spin_unlock(BH_State, &bh->b_state);
+ clear_bit(BH_State, &bh->b_state);
+ smp_mb__after_clear_bit();
+ wake_up_bit(&bh->b_state, BH_State);
+ __release(bitlock);
}
static inline void jbd_lock_bh_journal_head(struct buffer_head *bh)
{
- bit_spin_lock(BH_JournalHead, &bh->b_state);
+ wait_on_bit_lock(&bh->b_state, BH_JournalHead, &jbd_lock_bh_sleep,
+ TASK_UNINTERRUPTIBLE);
+ __acquire(bitlock);
}
static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
{
- bit_spin_unlock(BH_JournalHead, &bh->b_state);
+ clear_bit(BH_JournalHead, &bh->b_state);
+ smp_mb__after_clear_bit();
+ wake_up_bit(&bh->b_state, BH_JournalHead);
+ __release(bitlock);
}
+#else /* ! (CONFIG_SMP || CONFIG_DEBUG_SPINLOCK || CONFIG_PREEMPT) */
+
+static inline void jbd_lock_bh_state(struct buffer_head *bh)
+{
+ __acquire(journal_bh_state_lock);
+}
+
+static inline int jbd_trylock_bh_state(struct buffer_head *bh)
+{
+ __acquire(journal_bh_state_lock);
+ return 1;
+}
+
+static inline int jbd_is_locked_bh_state(struct buffer_head *bh)
+{
+ return 1;
+}
+
+static inline void jbd_unlock_bh_state(struct buffer_head *bh)
+{
+ __release(journal_bh_state_lock);
+}
+
+static inline void jbd_lock_bh_journal_head(struct buffer_head *bh)
+{
+ __acquire(journal_bh_journal_lock);
+}
+
+static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
+{
+ __release(journal_bh_journal_lock);
+}
+#endif /* (CONFIG_SMP || CONFIG_DEBUG_SPINLOCK || CONFIG_PREEMPT) */
+
+
struct jbd_revoke_table_s;
/**
Index: linux_realtime_ernie/fs/jbd/journal.c
===================================================================
--- linux_realtime_ernie/fs/jbd/journal.c (revision 266)
+++ linux_realtime_ernie/fs/jbd/journal.c (working copy)
@@ -80,6 +80,14 @@
EXPORT_SYMBOL(journal_try_to_free_buffers);
EXPORT_SYMBOL(journal_force_commit);
+#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT)
+int jbd_lock_bh_sleep(void *notused)
+{
+ schedule();
+ return 0;
+}
+#endif
+
static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *);
/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|