All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cesar Eduardo Barros <cesarb@cesarb.net>
To: linux-mm@kvack.org
Cc: Minchan Kim <minchan.kim@gmail.com>,
	Jan Beulich <JBeulich@novell.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andreas Dilger <adilger@sun.com>,
	Dan Magenheimer <dan.magenheimer@oracle.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	linux-kernel@vger.kernel.org,
	Cesar Eduardo Barros <cesarb@cesarb.net>
Subject: [PATCH] cleancache: use __read_mostly for cleancache_enabled
Date: Sun, 29 May 2011 17:38:18 -0300	[thread overview]
Message-ID: <1306701498-10846-1-git-send-email-cesarb@cesarb.net> (raw)

The global variable cleancache_enabled is read often but written to
rarely. Use __read_mostly to prevent it being on the same cacheline as
another variable which is written to often, which would cause cacheline
bouncing.

Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
---
 include/linux/cleancache.h |    2 +-
 mm/cleancache.c            |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
index 04ffb2e..83fffe8 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -42,7 +42,7 @@ extern void __cleancache_put_page(struct page *);
 extern void __cleancache_flush_page(struct address_space *, struct page *);
 extern void __cleancache_flush_inode(struct address_space *);
 extern void __cleancache_flush_fs(struct super_block *);
-extern int cleancache_enabled;
+extern int cleancache_enabled __read_mostly;
 
 #ifdef CONFIG_CLEANCACHE
 static inline bool cleancache_fs_enabled(struct page *page)
diff --git a/mm/cleancache.c b/mm/cleancache.c
index bcaae4c..a3d7a22 100644
--- a/mm/cleancache.c
+++ b/mm/cleancache.c
@@ -24,7 +24,7 @@
  * disabled), so is preferred to the slower alternative: a function
  * call that checks a non-global.
  */
-int cleancache_enabled;
+int cleancache_enabled __read_mostly;
 EXPORT_SYMBOL(cleancache_enabled);
 
 /*
-- 
1.7.4.4


WARNING: multiple messages have this Message-ID (diff)
From: Cesar Eduardo Barros <cesarb@cesarb.net>
To: linux-mm@kvack.org
Cc: Minchan Kim <minchan.kim@gmail.com>,
	Jan Beulich <JBeulich@novell.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andreas Dilger <adilger@sun.com>,
	Dan Magenheimer <dan.magenheimer@oracle.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	linux-kernel@vger.kernel.org,
	Cesar Eduardo Barros <cesarb@cesarb.net>
Subject: [PATCH] cleancache: use __read_mostly for cleancache_enabled
Date: Sun, 29 May 2011 17:38:18 -0300	[thread overview]
Message-ID: <1306701498-10846-1-git-send-email-cesarb@cesarb.net> (raw)

The global variable cleancache_enabled is read often but written to
rarely. Use __read_mostly to prevent it being on the same cacheline as
another variable which is written to often, which would cause cacheline
bouncing.

Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
---
 include/linux/cleancache.h |    2 +-
 mm/cleancache.c            |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
index 04ffb2e..83fffe8 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -42,7 +42,7 @@ extern void __cleancache_put_page(struct page *);
 extern void __cleancache_flush_page(struct address_space *, struct page *);
 extern void __cleancache_flush_inode(struct address_space *);
 extern void __cleancache_flush_fs(struct super_block *);
-extern int cleancache_enabled;
+extern int cleancache_enabled __read_mostly;
 
 #ifdef CONFIG_CLEANCACHE
 static inline bool cleancache_fs_enabled(struct page *page)
diff --git a/mm/cleancache.c b/mm/cleancache.c
index bcaae4c..a3d7a22 100644
--- a/mm/cleancache.c
+++ b/mm/cleancache.c
@@ -24,7 +24,7 @@
  * disabled), so is preferred to the slower alternative: a function
  * call that checks a non-global.
  */
-int cleancache_enabled;
+int cleancache_enabled __read_mostly;
 EXPORT_SYMBOL(cleancache_enabled);
 
 /*
-- 
1.7.4.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2011-05-29 20:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-29 20:38 Cesar Eduardo Barros [this message]
2011-05-29 20:38 ` [PATCH] cleancache: use __read_mostly for cleancache_enabled Cesar Eduardo Barros
2011-05-30  0:35 ` Minchan Kim
2011-05-30  0:35   ` Minchan Kim

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=1306701498-10846-1-git-send-email-cesarb@cesarb.net \
    --to=cesarb@cesarb.net \
    --cc=JBeulich@novell.com \
    --cc=adilger@sun.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.magenheimer@oracle.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.