Thread (31 messages) 31 messages, 7 authors, 2023-01-30
STALE1218d
Revisions (2)
  1. v1 current
  2. v2 [diff vs current]

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

From: Stefan Roesch <hidden>
Date: 2023-01-23 18:00:07
Also in: linux-doc, linux-fsdevel, linux-kselftest, linux-mm, lkml
Subsystem: memory management, memory management - ksm (kernel samepage merging), the rest · Maintainers: Andrew Morton, David Hildenbrand, Linus Torvalds

This splits off the pages_volatile function. The next patch will use
this function.

Signed-off-by: Stefan Roesch <redacted>
---
 mm/ksm.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
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);
 
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help