public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org,
	linux-rt-users <linux-rt-users@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Carsten Emde <C.Emde@osadl.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	John Kacur <jkacur@redhat.com>,
	Gilad Ben-Yossef <gilad@benyossef.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH RT 7/8] fs: only send IPI to invalidate LRU BH when needed
Date: Wed, 15 Jan 2014 20:58:31 -0500	[thread overview]
Message-ID: <20140116020325.547144711@goodmis.org> (raw)
In-Reply-To: 20140116015824.201732155@goodmis.org

[-- Attachment #1: 0007-fs-only-send-IPI-to-invalidate-LRU-BH-when-needed.patch --]
[-- Type: text/plain, Size: 1946 bytes --]

3.2.53-rt76-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Gilad Ben-Yossef <gilad@benyossef.com>

[ Upstream commit 42be35d0390b966253136a285f507f5ad00fd9e8 ]

In several code paths, such as when unmounting a file system (but not
only) we send an IPI to ask each cpu to invalidate its local LRU BHs.

For multi-cores systems that have many cpus that may not have any LRU BH
because they are idle or because they have not performed any file system
accesses since last invalidation (e.g.  CPU crunching on high perfomance
computing nodes that write results to shared memory or only using
filesystems that do not use the bh layer.) This can lead to loss of
performance each time someone switches the KVM (the virtual keyboard and
screen type, not the hypervisor) if it has a USB storage stuck in.

This patch attempts to only send an IPI to cpus that have LRU BH.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 fs/buffer.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 997b199..36d49f1 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1425,10 +1425,23 @@ static void invalidate_bh_lru(void *arg)
 	}
 	put_cpu_var(bh_lrus);
 }
+
+static bool has_bh_in_lru(int cpu, void *dummy)
+{
+	struct bh_lru *b = per_cpu_ptr(&bh_lrus, cpu);
+	int i;
 	
+	for (i = 0; i < BH_LRU_SIZE; i++) {
+		if (b->bhs[i])
+			return 1;
+	}
+
+	return 0;
+}
+
 void invalidate_bh_lrus(void)
 {
-	on_each_cpu(invalidate_bh_lru, NULL, 1);
+	on_each_cpu_cond(has_bh_in_lru, invalidate_bh_lru, NULL, 1, GFP_KERNEL);
 }
 EXPORT_SYMBOL_GPL(invalidate_bh_lrus);
 
-- 
1.8.4.3



  parent reply	other threads:[~2014-01-16  2:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-16  1:58 [PATCH RT 0/8] Linux 3.2.53-rt76-rc1 Steven Rostedt
2014-01-16  1:58 ` [PATCH RT 1/8] cpu_down: move migrate_enable() back Steven Rostedt
2014-01-16  1:58 ` [PATCH RT 2/8] swait: Add a few more users Steven Rostedt
2014-01-16  1:58 ` [PATCH RT 3/8] lockdep: Correctly annotate hardirq context in irq_exit() Steven Rostedt
2014-01-16  1:58 ` [PATCH RT 4/8] rtmutex: use a trylock for waiter lock in trylock Steven Rostedt
2014-01-16  3:08   ` Mike Galbraith
2014-01-17  4:22     ` Steven Rostedt
2014-01-17  5:17       ` Mike Galbraith
2014-01-31 22:07         ` Sebastian Andrzej Siewior
2014-02-01  4:21           ` Mike Galbraith
2014-02-01  4:54             ` Mike Galbraith
2014-01-16  1:58 ` [PATCH RT 5/8] smp: introduce a generic on_each_cpu_mask() function Steven Rostedt
2014-01-16  1:58 ` [PATCH RT 6/8] smp: add func to IPI cpus based on parameter func Steven Rostedt
2014-01-16  1:58 ` Steven Rostedt [this message]
2014-01-16  1:58 ` [PATCH RT 8/8] Linux 3.2.53-rt76-rc1 Steven Rostedt
2014-01-16  9:41 ` [PATCH RT 0/8] " Pavel Vasilyev
2014-01-16 14:18   ` Steven Rostedt
2014-01-16 14:36     ` Pavel Vasilyev
2014-01-16 15:09       ` Steven Rostedt
2014-01-16 16:08       ` Steven Rostedt
2014-01-16 17:19         ` Pavel Vasilyev
2014-01-16 16:18       ` Sebastian Andrzej Siewior

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=20140116020325.547144711@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=C.Emde@osadl.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=gilad@benyossef.com \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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