linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: linux-rt-users@vger.kernel.org
Cc: hermann <brummer-@web.de>, Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH] Various fixups from first bug reports
Date: Thu, 21 Jul 2011 21:57:57 +0200	[thread overview]
Message-ID: <1311278277-8222-1-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <alpine.LFD.2.02.1107211932440.2702@ionos>

From: Thomas Gleixner <tglx@linutronix.de>

---
Hello,

this is the patch Thomas sent earlier in this thread with the two fixups
folded in that occured in reply to Thomas' patch.

Best regards
Uwe

 include/linux/buffer_head.h |    6 ++++--
 kernel/timer.c              |   40 ++++++++++++++++++++++++++++++++--------
 mm/page_alloc.c             |    4 ++--
 3 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 7283b77..dbaeaec 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -74,7 +74,8 @@ struct buffer_head {
 	atomic_t b_count;		/* users using this buffer_head */
 #ifdef CONFIG_PREEMPT_RT_BASE
 	spinlock_t b_uptodate_lock;
-#if defined(CONFIG_JBD) || defined(CONFIG_JBD2)
+#if defined(CONFIG_JBD) || defined(CONFIG_JBD_MODULE) || \
+    defined(CONFIG_JBD2) || defined(CONFIG_JBD2_MODULE)
 	spinlock_t b_state_lock;
 	spinlock_t b_journal_head_lock;
 #endif
@@ -109,7 +110,8 @@ static inline void buffer_head_init_locks(struct buffer_head *bh)
 {
 #ifdef CONFIG_PREEMPT_RT_BASE
 	spin_lock_init(&bh->b_uptodate_lock);
-#if defined(CONFIG_JBD) || defined(CONFIG_JBD2)
+#if defined(CONFIG_JBD) || defined(CONFIG_JBD_MODULE) || \
+    defined(CONFIG_JBD2) || defined(CONFIG_JBD2_MODULE)
 	spin_lock_init(&bh->b_state_lock);
 	spin_lock_init(&bh->b_journal_head_lock);
 #endif
diff --git a/kernel/timer.c b/kernel/timer.c
index 20b548f..937799f 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -654,6 +654,36 @@ static struct tvec_base *lock_timer_base(struct timer_list *timer,
 	}
 }
 
+#ifndef CONFIG_PREEMPT_RT_FULL
+static inline struct tvec_base *switch_timer_base(struct timer_list *timer,
+						  struct tvec_base *old,
+						  struct tvec_base *new)
+{
+	/* See the comment in lock_timer_base() */
+	timer_set_base(timer, NULL);
+	spin_unlock(&old->lock);
+	spin_lock(&new->lock);
+	timer_set_base(timer, new);
+	return new;
+}
+#else
+static inline struct tvec_base *switch_timer_base(struct timer_list *timer,
+						  struct tvec_base *old,
+						  struct tvec_base *new)
+{
+	/*
+	 * We cannot do the above because we might be preempted and
+	 * then the preempter would see NULL and loop forever.
+	 */
+	if (spin_trylock(&new->lock)) {
+		timer_set_base(timer, new);
+		spin_unlock(&old->lock);
+		return new;
+	}
+	return old;
+}
+#endif
+
 static inline int
 __mod_timer(struct timer_list *timer, unsigned long expires,
 						bool pending_only, int pinned)
@@ -699,14 +729,8 @@ __mod_timer(struct timer_list *timer, unsigned long expires,
 		 * handler yet has not finished. This also guarantees that
 		 * the timer is serialized wrt itself.
 		 */
-		if (likely(base->running_timer != timer)) {
-			/* See the comment in lock_timer_base() */
-			timer_set_base(timer, NULL);
-			spin_unlock(&base->lock);
-			base = new_base;
-			spin_lock(&base->lock);
-			timer_set_base(timer, base);
-		}
+		if (likely(base->running_timer != timer))
+			base = switch_timer_base(timer, base, new_base);
 	}
 
 	timer->expires = expires;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 57d70b8..33fd80f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1943,8 +1943,8 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
 	if (*did_some_progress != COMPACT_SKIPPED) {
 
 		/* Page migration frees to the PCP lists but we want merging */
-		drain_pages(get_cpu());
-		put_cpu();
+		drain_pages(get_cpu_light());
+		put_cpu_light();
 
 		page = get_page_from_freelist(gfp_mask, nodemask,
 				order, zonelist, high_zoneidx,
-- 
1.7.5.4


  parent reply	other threads:[~2011-07-21 19:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-21 16:22 [ANNOUNCE] 3.0-rc7-rt0 hermann
2011-07-21 17:35 ` Thomas Gleixner
2011-07-21 17:43   ` Thomas Gleixner
2011-07-21 18:33     ` hermann
2011-07-23  4:08     ` [ANNOUNCE] 3.0-rt1 hermann
2011-07-23  7:37       ` Thomas Gleixner
2011-07-21 18:28   ` [ANNOUNCE] 3.0-rc7-rt0 andi
2011-07-21 18:40     ` hermann
2011-07-21 19:57   ` Uwe Kleine-König [this message]
2011-07-22  5:43     ` [PATCH] Various fixups from first bug reports hermann
2011-07-22  6:57       ` Uwe Kleine-König
2011-07-22  7:40         ` hermann
2011-07-22 10:06           ` Trulan Martin
2011-07-22 11:04         ` Rusty Russell
2011-07-22 19:20           ` Uwe Kleine-König
2011-07-23  3:17             ` hermann
2011-07-23  9:57               ` Robin Gareus
     [not found]                 ` <4E2A9B18.6030000-+VlDMftONaMdnm+yROfE0A@public.gmane.org>
2011-07-23 14:19                   ` hermann
2011-07-23 14:33                     ` Robin Gareus
2011-07-23 15:21                       ` hermann
2011-07-23 18:53                     ` Uwe Kleine-König

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=1311278277-8222-1-git-send-email-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=brummer-@web.de \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).