mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
mm/balloon_compaction: add vmstat counters and kpageflags bit
Always mark pages with PageBalloon even if balloon compaction is disabled and expose this mark in /proc/kpageflags as KPF_BALLOON. Also this patch adds three counters into /proc/vmstat: "balloon_inflate", "balloon_deflate" and "balloon_migrate". They accumulate balloon activity. Current size of balloon is (balloon_inflate - balloon_deflate) pages. All generic balloon code now gathered under option CONFIG_MEMORY_BALLOON. It should be selected by ballooning driver which wants use this feature. Currently virtio-balloon is the only user. Signed-off-by: Konstantin Khlebnikov <[email protected]> Cc: Rafael Aquini <[email protected]> Cc: Andrey Ryabinin <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
9d1ba80564
commit
09316c09dd
11 changed files with 37 additions and 3 deletions
|
|
@ -230,12 +230,17 @@ config SPLIT_PTLOCK_CPUS
|
|||
config ARCH_ENABLE_SPLIT_PMD_PTLOCK
|
||||
boolean
|
||||
|
||||
#
|
||||
# support for memory balloon
|
||||
config MEMORY_BALLOON
|
||||
boolean
|
||||
|
||||
#
|
||||
# support for memory balloon compaction
|
||||
config BALLOON_COMPACTION
|
||||
bool "Allow for balloon memory compaction/migration"
|
||||
def_bool y
|
||||
depends on COMPACTION && VIRTIO_BALLOON
|
||||
depends on COMPACTION && MEMORY_BALLOON
|
||||
help
|
||||
Memory fragmentation introduced by ballooning might reduce
|
||||
significantly the number of 2MB contiguous memory blocks that can be
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ obj-y := filemap.o mempool.o oom_kill.o \
|
|||
readahead.o swap.o truncate.o vmscan.o shmem.o \
|
||||
util.o mmzone.o vmstat.o backing-dev.o \
|
||||
mm_init.o mmu_context.o percpu.o slab_common.o \
|
||||
compaction.o balloon_compaction.o vmacache.o \
|
||||
compaction.o vmacache.o \
|
||||
interval_tree.o list_lru.o workingset.o \
|
||||
iov_iter.o debug.o $(mmu-y)
|
||||
|
||||
|
|
@ -67,3 +67,4 @@ obj-$(CONFIG_ZBUD) += zbud.o
|
|||
obj-$(CONFIG_ZSMALLOC) += zsmalloc.o
|
||||
obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o
|
||||
obj-$(CONFIG_CMA) += cma.o
|
||||
obj-$(CONFIG_MEMORY_BALLOON) += balloon_compaction.o
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info)
|
|||
BUG_ON(!trylock_page(page));
|
||||
spin_lock_irqsave(&b_dev_info->pages_lock, flags);
|
||||
balloon_page_insert(b_dev_info, page);
|
||||
__count_vm_event(BALLOON_INFLATE);
|
||||
spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
|
||||
unlock_page(page);
|
||||
return page;
|
||||
|
|
@ -74,6 +75,7 @@ struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info)
|
|||
}
|
||||
spin_lock_irqsave(&b_dev_info->pages_lock, flags);
|
||||
balloon_page_delete(page);
|
||||
__count_vm_event(BALLOON_DEFLATE);
|
||||
spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
|
||||
unlock_page(page);
|
||||
dequeued_page = true;
|
||||
|
|
|
|||
12
mm/vmstat.c
12
mm/vmstat.c
|
|
@ -735,7 +735,7 @@ static void walk_zones_in_node(struct seq_file *m, pg_data_t *pgdat,
|
|||
TEXT_FOR_HIGHMEM(xx) xx "_movable",
|
||||
|
||||
const char * const vmstat_text[] = {
|
||||
/* Zoned VM counters */
|
||||
/* enum zone_stat_item countes */
|
||||
"nr_free_pages",
|
||||
"nr_alloc_batch",
|
||||
"nr_inactive_anon",
|
||||
|
|
@ -778,10 +778,13 @@ const char * const vmstat_text[] = {
|
|||
"workingset_nodereclaim",
|
||||
"nr_anon_transparent_hugepages",
|
||||
"nr_free_cma",
|
||||
|
||||
/* enum writeback_stat_item counters */
|
||||
"nr_dirty_threshold",
|
||||
"nr_dirty_background_threshold",
|
||||
|
||||
#ifdef CONFIG_VM_EVENT_COUNTERS
|
||||
/* enum vm_event_item counters */
|
||||
"pgpgin",
|
||||
"pgpgout",
|
||||
"pswpin",
|
||||
|
|
@ -860,6 +863,13 @@ const char * const vmstat_text[] = {
|
|||
"thp_zero_page_alloc",
|
||||
"thp_zero_page_alloc_failed",
|
||||
#endif
|
||||
#ifdef CONFIG_MEMORY_BALLOON
|
||||
"balloon_inflate",
|
||||
"balloon_deflate",
|
||||
#ifdef CONFIG_BALLOON_COMPACTION
|
||||
"balloon_migrate",
|
||||
#endif
|
||||
#endif /* CONFIG_MEMORY_BALLOON */
|
||||
#ifdef CONFIG_DEBUG_TLBFLUSH
|
||||
#ifdef CONFIG_SMP
|
||||
"nr_tlb_remote_flush",
|
||||
|
|
|
|||
Loading…
Reference in a new issue