From: Liang Li <liang.z.li@intel.com>
To: kvm@vger.kernel.org
Cc: virtio-dev@lists.oasis-open.org, qemu-devel@nongun.org,
linux-kernel@vger.kernel.org, mst@redhat.com,
Liang Li <liang.z.li@intel.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
Amit Shah <amit.shah@redhat.com>,
Alexander Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH 3/6] mm:split the drop cache operation into a function
Date: Mon, 13 Jun 2016 17:47:10 +0800 [thread overview]
Message-ID: <1465811233-21136-4-git-send-email-liang.z.li@intel.com> (raw)
In-Reply-To: <1465811233-21136-1-git-send-email-liang.z.li@intel.com>
Put the drop caches operation in a new function and export it, then
wen can reuse it later.
Signed-off-by: Liang Li <liang.z.li@intel.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Amit Shah <amit.shah@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
---
fs/drop_caches.c | 22 ++++++++++++++--------
include/linux/mm.h | 1 +
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index d72d52b..977dc71 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -50,14 +50,7 @@ int drop_caches_sysctl_handler(struct ctl_table *table, int write,
if (write) {
static int stfu;
- if (sysctl_drop_caches & 1) {
- iterate_supers(drop_pagecache_sb, NULL);
- count_vm_event(DROP_PAGECACHE);
- }
- if (sysctl_drop_caches & 2) {
- drop_slab();
- count_vm_event(DROP_SLAB);
- }
+ drop_caches(sysctl_drop_caches);
if (!stfu) {
pr_info("%s (%d): drop_caches: %d\n",
current->comm, task_pid_nr(current),
@@ -67,3 +60,16 @@ int drop_caches_sysctl_handler(struct ctl_table *table, int write,
}
return 0;
}
+
+void drop_caches(int drop_ctl)
+{
+ if (drop_ctl & 1) {
+ iterate_supers(drop_pagecache_sb, NULL);
+ count_vm_event(DROP_PAGECACHE);
+ }
+ if (drop_ctl & 2) {
+ drop_slab();
+ count_vm_event(DROP_SLAB);
+ }
+}
+EXPORT_SYMBOL_GPL(drop_caches);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 5df5feb..e22e315 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2263,6 +2263,7 @@ static inline int in_gate_area(struct mm_struct *mm, unsigned long addr)
extern int sysctl_drop_caches;
int drop_caches_sysctl_handler(struct ctl_table *, int,
void __user *, size_t *, loff_t *);
+void drop_caches(int drop_ctl);
#endif
void drop_slab(void);
--
1.9.1
next prev parent reply other threads:[~2016-06-13 9:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 9:47 [PATCH 0/6] Fast balloon & fast live migration Liang Li
2016-06-13 9:47 ` [PATCH 1/6] virtio-balloon: rework deflate to add page to a list Liang Li
2016-06-23 8:25 ` Li, Liang Z
2016-06-23 8:30 ` Li, Liang Z
2016-06-13 9:47 ` [PATCH 2/6] virtio-balloon: speed up inflate/deflate process Liang Li
2016-06-13 10:17 ` kbuild test robot
2016-06-24 5:39 ` Michael S. Tsirkin
2016-06-24 6:28 ` Li, Liang Z
2016-06-13 9:47 ` Liang Li [this message]
2016-06-13 9:47 ` [PATCH 4/6] virtio-balloon: add drop cache support Liang Li
2016-06-13 9:47 ` [PATCH 5/6] mm: add the related functions to get free page info Liang Li
2016-06-13 9:47 ` [PATCH 6/6] virtio-balloon: tell host vm's " Liang Li
2016-06-23 8:27 ` [PATCH 0/6] Fast balloon & fast live migration Li, Liang Z
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=1465811233-21136-4-git-send-email-liang.z.li@intel.com \
--to=liang.z.li@intel.com \
--cc=amit.shah@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongun.org \
--cc=viro@zeniv.linux.org.uk \
--cc=virtio-dev@lists.oasis-open.org \
/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).