mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 12:58:12 -04:00
Merge "mm: cma: Register with show_mem notification framework"
This commit is contained in:
commit
6324083247
1 changed files with 26 additions and 0 deletions
26
mm/cma.c
26
mm/cma.c
|
|
@ -34,6 +34,7 @@
|
|||
#include <linux/io.h>
|
||||
#include <linux/kmemleak.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/show_mem_notifier.h>
|
||||
#include <trace/events/cma.h>
|
||||
|
||||
#include "cma.h"
|
||||
|
|
@ -96,6 +97,29 @@ static void cma_clear_bitmap(struct cma *cma, unsigned long pfn,
|
|||
mutex_unlock(&cma->lock);
|
||||
}
|
||||
|
||||
static int cma_showmem_notifier(struct notifier_block *nb,
|
||||
unsigned long action, void *data)
|
||||
{
|
||||
int i;
|
||||
unsigned long used;
|
||||
struct cma *cma;
|
||||
|
||||
for (i = 0; i < cma_area_count; i++) {
|
||||
cma = &cma_areas[i];
|
||||
used = bitmap_weight(cma->bitmap,
|
||||
(int)cma_bitmap_maxno(cma));
|
||||
used <<= cma->order_per_bit;
|
||||
pr_info("cma-%d pages: => %lu used of %lu total pages\n",
|
||||
i, used, cma->count);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct notifier_block cma_nb = {
|
||||
.notifier_call = cma_showmem_notifier,
|
||||
};
|
||||
|
||||
static int __init cma_activate_area(struct cma *cma)
|
||||
{
|
||||
int bitmap_size = BITS_TO_LONGS(cma_bitmap_maxno(cma)) * sizeof(long);
|
||||
|
|
@ -158,6 +182,8 @@ static int __init cma_init_reserved_areas(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
show_mem_notifier_register(&cma_nb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
core_initcall(cma_init_reserved_areas);
|
||||
|
|
|
|||
Loading…
Reference in a new issue