public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: "Stephen C. Tweedie" <sct@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [patch] Real-Time Preemption, -RT-2.6.13-rc4-V0.7.52-01
Date: Mon, 01 Aug 2005 15:49:59 -0400	[thread overview]
Message-ID: <1122925799.6759.38.camel@localhost.localdomain> (raw)
In-Reply-To: <1122920564.6759.15.camel@localhost.localdomain>

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 <rostedt@goodmis.org>

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 *);
 
 /*



  reply	other threads:[~2005-08-01 19:52 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-30 16:03 [patch] Real-Time Preemption, -RT-2.6.13-rc4-V0.7.52-01 Ingo Molnar
2005-07-30 20:47 ` Peter Zijlstra
2005-07-30 20:52   ` Ingo Molnar
2005-07-31  4:47     ` Lee Revell
2005-07-31  6:38       ` Ingo Molnar
2005-08-01  4:45         ` Lee Revell
2005-08-01 21:08           ` Ingo Molnar
2005-08-01 21:12             ` Ingo Molnar
2005-08-02 13:56           ` Steven Rostedt
2005-08-02 14:05             ` Lee Revell
2005-08-02 14:20               ` Steven Rostedt
2005-08-02 15:37                 ` 2.6.13-rc3 -> sluggish PS2 keyboard (was Re: [patch] Real-Time Preemption, -RT-2.6.13-rc4-V0.7.52-01) Lee Revell
2005-08-02 15:44                   ` Vojtech Pavlik
2005-08-02 15:46                     ` Lee Revell
2005-08-02 15:47                     ` Lee Revell
2005-08-02 15:53                       ` Steven Rostedt
2005-08-02 15:55                       ` Vojtech Pavlik
2005-08-02 15:55                   ` Dmitry Torokhov
2005-08-02 15:38                 ` [patch] Real-Time Preemption, -RT-2.6.13-rc4-V0.7.52-01 Lee Revell
2005-07-31  8:03     ` Peter Zijlstra
2005-07-31 10:44       ` Ingo Molnar
2005-07-31 15:56         ` [patch] Real-Time Preemption, -RT-2.6.13-rc4-V0.7.52-05 Gene Heskett
2005-08-01 18:22 ` [patch] Real-Time Preemption, -RT-2.6.13-rc4-V0.7.52-01 Steven Rostedt
2005-08-01 19:49   ` Steven Rostedt [this message]
2005-08-01 20:52   ` Ingo Molnar
2005-08-01 21:09     ` Daniel Walker
2005-08-01 21:15       ` Ingo Molnar
2005-08-02  0:43       ` Steven Rostedt
2005-08-01 21:15     ` Steven Rostedt
2005-08-01 21:23       ` Ingo Molnar
2005-08-01 21:20   ` Daniel Walker
2005-08-02  0:53     ` Steven Rostedt
2005-08-02 10:19       ` Ingo Molnar
2005-08-02 19:45         ` Steven Rostedt
2005-08-02 19:56           ` Steven Rostedt
2005-08-02 23:38           ` Daniel Walker
2005-08-03  0:00             ` Steven Rostedt
2005-08-03  1:12               ` George Anzinger
2005-08-03  1:48                 ` Keith Owens
2005-08-03  2:12                   ` George Anzinger
2005-08-03  2:25               ` Daniel Walker
2005-08-03  2:42                 ` Steven Rostedt
2005-08-03  2:58                   ` Daniel Walker
2005-08-03 10:30                     ` Steven Rostedt
2005-08-03 15:10                       ` Daniel Walker
2005-08-03 10:37                     ` [Question] arch-independent way to differentiate between user and kernel Steven Rostedt
2005-08-03 10:48                       ` Ingo Molnar
2005-08-03 12:18                         ` Steven Rostedt
2005-08-03 10:56                       ` [Question] arch-independent way to differentiate between user andkernel linux-os (Dick Johnson)
2005-08-03 11:44                         ` Steven Rostedt
2005-08-03 12:04                           ` Ingo Molnar
2005-08-03 12:30                             ` Steven Rostedt
2005-08-03 14:50                     ` [patch] Real-Time Preemption, -RT-2.6.13-rc4-V0.7.52-01 Steven Rostedt
2005-08-03 15:15                       ` Steven Rostedt
2005-08-03 15:57                         ` Steven Rostedt
2005-08-03 16:44                       ` Steven Rostedt
     [not found]                         ` <20050812125844.GA13357@elte.hu>
2005-08-26  4:24                           ` Steven Rostedt
2005-08-26  6:08                             ` Ingo Molnar
2005-08-26 11:20                               ` Steven Rostedt
2005-08-30 10:58                                 ` Stephen C. Tweedie
2005-08-30 11:14                                   ` Ingo Molnar
2005-08-30 11:00                             ` Stephen C. Tweedie
2005-08-02  3:55     ` Steven Rostedt
2005-08-02  4:07       ` Daniel Walker
2005-08-02 14:53 ` Steven Rostedt
2005-08-04 12:20 ` Andrzej Nowak

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=1122925799.6759.38.camel@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sct@redhat.com \
    /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