diff mbox series

[RESEND,RFC,v1,08/20] mm: split off pages_volatile function

Message ID 20230123173748.1734238-9-shr@devkernel.io (mailing list archive)
State Not Applicable
Headers show
Series mm: process/cgroup ksm support | expand

Commit Message

Stefan Roesch Jan. 23, 2023, 5:37 p.m. UTC
This splits off the pages_volatile function. The next patch will use
this function.

Signed-off-by: Stefan Roesch <shr@devkernel.io>
---
 mm/ksm.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/mm/ksm.c b/mm/ksm.c
index 88a969849955..19f434f97dc1 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -3182,8 +3182,7 @@  static ssize_t pages_unshared_show(struct kobject *kobj,
 }
 KSM_ATTR_RO(pages_unshared);
 
-static ssize_t pages_volatile_show(struct kobject *kobj,
-				   struct kobj_attribute *attr, char *buf)
+static long pages_volatile(void)
 {
 	long ksm_pages_volatile;
 
@@ -3195,7 +3194,14 @@  static ssize_t pages_volatile_show(struct kobject *kobj,
 	 */
 	if (ksm_pages_volatile < 0)
 		ksm_pages_volatile = 0;
-	return sysfs_emit(buf, "%ld\n", ksm_pages_volatile);
+
+	return ksm_pages_volatile;
+}
+
+static ssize_t pages_volatile_show(struct kobject *kobj,
+				   struct kobj_attribute *attr, char *buf)
+{
+	return sysfs_emit(buf, "%ld\n", pages_volatile());
 }
 KSM_ATTR_RO(pages_volatile);