Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5260478 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ksm: Add showmem notifier"

parents 21f59ad9 28851c13
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include <linux/freezer.h>
#include <linux/oom.h>
#include <linux/numa.h>
#include <linux/show_mem_notifier.h>

#include <asm/tlbflush.h>
#include "internal.h"
@@ -250,6 +251,20 @@ static DEFINE_SPINLOCK(ksm_mmlist_lock);
		sizeof(struct __struct), __alignof__(struct __struct),\
		(__flags), NULL)

static int ksm_show_mem_notifier(struct notifier_block *nb,
				unsigned long action,
				void *data)
{
	pr_info("ksm_pages_sharing: %lu\n", ksm_pages_sharing);
	pr_info("ksm_pages_shared: %lu\n", ksm_pages_shared);

	return 0;
}

static struct notifier_block ksm_show_mem_notifier_block = {
	.notifier_call = ksm_show_mem_notifier,
};

static int __init ksm_slab_init(void)
{
	rmap_item_cache = KSM_KMEM_CACHE(rmap_item, 0);
@@ -2494,6 +2509,8 @@ static int __init ksm_init(void)
	/* There is no significance to this priority 100 */
	hotplug_memory_notifier(ksm_memory_callback, 100);
#endif

	show_mem_notifier_register(&ksm_show_mem_notifier_block);
	return 0;

out_free: