All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shaohua Li <shli@kernel.org>
To: linux-mm@kvack.org
Cc: sjenning@linux.vnet.ibm.com, bob.liu@oracle.com,
	dan.magenheimer@oracle.com
Subject: [RFC 3/4] cleancache: invalidate cache at dirty page
Date: Thu, 26 Sep 2013 22:14:31 +0800	[thread overview]
Message-ID: <20130926141614.283085918@kernel.org> (raw)
In-Reply-To: 20130926141428.392345308@kernel.org

[-- Attachment #1: cleancache-invalidate-cache-dirty-page.patch --]
[-- Type: text/plain, Size: 2446 bytes --]

Previously if a get_page is called we must invalidate cache of the page in
cleancache backend, because at next put_page we don't know if the page's
content is changed. If we know whether the page content is changed, we don't
need always invalidate cache in get_page of cleancache backend, which could
save a lot of IO if we do put_page/get_page later. The detection can be done at
page dirty, where the page content is changed. If we dirty a page, we
invalidate the page's cache in cleancache backend, get_page doesn't need do
invalidation any more. Of course, it's ok if get_page insists doing
invalidation.

Signed-off-by: Shaohua Li <shli@kernel.org>
---
 fs/buffer.c         |    2 ++
 mm/page-writeback.c |    3 +++
 2 files changed, 5 insertions(+)

Index: linux/fs/buffer.c
===================================================================
--- linux.orig/fs/buffer.c	2013-09-26 21:25:03.671450043 +0800
+++ linux/fs/buffer.c	2013-09-26 21:25:03.663449708 +0800
@@ -40,6 +40,7 @@
 #include <linux/cpu.h>
 #include <linux/bitops.h>
 #include <linux/mpage.h>
+#include <linux/cleancache.h>
 #include <linux/bit_spinlock.h>
 #include <trace/events/block.h>
 
@@ -661,6 +662,7 @@ static void __set_page_dirty(struct page
 		radix_tree_tag_set(&mapping->page_tree,
 				page_index(page), PAGECACHE_TAG_DIRTY);
 	}
+	cleancache_invalidate_page(mapping, page);
 	spin_unlock_irq(&mapping->tree_lock);
 	__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
 }
Index: linux/mm/page-writeback.c
===================================================================
--- linux.orig/mm/page-writeback.c	2013-09-26 21:25:03.671450043 +0800
+++ linux/mm/page-writeback.c	2013-09-26 21:25:03.667449885 +0800
@@ -37,6 +37,7 @@
 #include <linux/timer.h>
 #include <linux/sched/rt.h>
 #include <linux/mm_inline.h>
+#include <linux/cleancache.h>
 #include <trace/events/writeback.h>
 
 #include "internal.h"
@@ -2191,6 +2192,8 @@ int __set_page_dirty_nobuffers(struct pa
 			radix_tree_tag_set(&mapping->page_tree,
 				page_index(page), PAGECACHE_TAG_DIRTY);
 		}
+		if (mapping->host)
+			cleancache_invalidate_page(mapping, page);
 		spin_unlock_irq(&mapping->tree_lock);
 		if (mapping->host) {
 			/* !PageAnon && !swapper_space */

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2013-09-26 14:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26 14:14 [RFC 0/4] cleancache: SSD backed cleancache backend Shaohua Li
2013-09-26 14:14 ` [RFC 1/4] cleancache: make put_page async possible Shaohua Li
2013-09-26 14:14 ` [RFC 2/4] cleancache: make get_page " Shaohua Li
2013-09-26 14:14 ` Shaohua Li [this message]
2013-09-26 14:14 ` [RFC 4/4] cleancache: SSD backed cleancache backend Shaohua Li
2013-09-26 16:14 ` [RFC 0/4] " Seth Jennings
2013-09-29  9:19   ` Shaohua Li
2013-10-09 11:52   ` Theodore Ts'o
2013-10-10 10:24     ` Alex Elsayed
2013-10-10 10:38     ` Bob Liu

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=20130926141614.283085918@kernel.org \
    --to=shli@kernel.org \
    --cc=bob.liu@oracle.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=sjenning@linux.vnet.ibm.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.