mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-31 18:09:19 +00:00
ksm: Add showmem notifier
KSM is yet another framework which may obfuscate some memory problems. Use the showmem notifier to show how KSM is being used to give some insight into potential issues or non-issues. Change-Id: If82405dc33f212d085e6847f7c511fd4d0a32a10 Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
This commit is contained in:
parent
ed1aff26c1
commit
28851c135c
1 changed files with 17 additions and 0 deletions
17
mm/ksm.c
17
mm/ksm.c
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue