diff options
author | Konstantin Khlebnikov <k.khlebnikov@samsung.com> | 2014-10-09 18:29:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-09 22:26:01 -0400 |
commit | 09316c09dde33aae14f34489d9e3d243ec0d5938 (patch) | |
tree | 3238cf34be33d587a93db64a9f934f8b1c69cfb8 /mm | |
parent | 9d1ba8056474a208ed9efb7e58cd014795d9f818 (diff) |
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 <k.khlebnikov@samsung.com>
Cc: Rafael Aquini <aquini@redhat.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/Kconfig | 7 | ||||
-rw-r--r-- | mm/Makefile | 3 | ||||
-rw-r--r-- | mm/balloon_compaction.c | 2 | ||||
-rw-r--r-- | mm/vmstat.c | 12 |
4 files changed, 21 insertions, 3 deletions
diff --git a/mm/Kconfig b/mm/Kconfig index 0ceb8a567dab..1d1ae6b078fd 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -231,11 +231,16 @@ config ARCH_ENABLE_SPLIT_PMD_PTLOCK | |||
231 | boolean | 231 | boolean |
232 | 232 | ||
233 | # | 233 | # |
234 | # support for memory balloon | ||
235 | config MEMORY_BALLOON | ||
236 | boolean | ||
237 | |||
238 | # | ||
234 | # support for memory balloon compaction | 239 | # support for memory balloon compaction |
235 | config BALLOON_COMPACTION | 240 | config BALLOON_COMPACTION |
236 | bool "Allow for balloon memory compaction/migration" | 241 | bool "Allow for balloon memory compaction/migration" |
237 | def_bool y | 242 | def_bool y |
238 | depends on COMPACTION && VIRTIO_BALLOON | 243 | depends on COMPACTION && MEMORY_BALLOON |
239 | help | 244 | help |
240 | Memory fragmentation introduced by ballooning might reduce | 245 | Memory fragmentation introduced by ballooning might reduce |
241 | significantly the number of 2MB contiguous memory blocks that can be | 246 | significantly the number of 2MB contiguous memory blocks that can be |
diff --git a/mm/Makefile b/mm/Makefile index f8ed7ab417b1..1f534a7f0a71 100644 --- a/mm/Makefile +++ b/mm/Makefile | |||
@@ -16,7 +16,7 @@ obj-y := filemap.o mempool.o oom_kill.o \ | |||
16 | readahead.o swap.o truncate.o vmscan.o shmem.o \ | 16 | readahead.o swap.o truncate.o vmscan.o shmem.o \ |
17 | util.o mmzone.o vmstat.o backing-dev.o \ | 17 | util.o mmzone.o vmstat.o backing-dev.o \ |
18 | mm_init.o mmu_context.o percpu.o slab_common.o \ | 18 | mm_init.o mmu_context.o percpu.o slab_common.o \ |
19 | compaction.o balloon_compaction.o vmacache.o \ | 19 | compaction.o vmacache.o \ |
20 | interval_tree.o list_lru.o workingset.o \ | 20 | interval_tree.o list_lru.o workingset.o \ |
21 | iov_iter.o debug.o $(mmu-y) | 21 | iov_iter.o debug.o $(mmu-y) |
22 | 22 | ||
@@ -67,3 +67,4 @@ obj-$(CONFIG_ZBUD) += zbud.o | |||
67 | obj-$(CONFIG_ZSMALLOC) += zsmalloc.o | 67 | obj-$(CONFIG_ZSMALLOC) += zsmalloc.o |
68 | obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o | 68 | obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o |
69 | obj-$(CONFIG_CMA) += cma.o | 69 | obj-$(CONFIG_CMA) += cma.o |
70 | obj-$(CONFIG_MEMORY_BALLOON) += balloon_compaction.o | ||
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c index 3afdabdbc0a4..b3cbe19f71b5 100644 --- a/mm/balloon_compaction.c +++ b/mm/balloon_compaction.c | |||
@@ -36,6 +36,7 @@ struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info) | |||
36 | BUG_ON(!trylock_page(page)); | 36 | BUG_ON(!trylock_page(page)); |
37 | spin_lock_irqsave(&b_dev_info->pages_lock, flags); | 37 | spin_lock_irqsave(&b_dev_info->pages_lock, flags); |
38 | balloon_page_insert(b_dev_info, page); | 38 | balloon_page_insert(b_dev_info, page); |
39 | __count_vm_event(BALLOON_INFLATE); | ||
39 | spin_unlock_irqrestore(&b_dev_info->pages_lock, flags); | 40 | spin_unlock_irqrestore(&b_dev_info->pages_lock, flags); |
40 | unlock_page(page); | 41 | unlock_page(page); |
41 | return page; | 42 | return page; |
@@ -74,6 +75,7 @@ struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info) | |||
74 | } | 75 | } |
75 | spin_lock_irqsave(&b_dev_info->pages_lock, flags); | 76 | spin_lock_irqsave(&b_dev_info->pages_lock, flags); |
76 | balloon_page_delete(page); | 77 | balloon_page_delete(page); |
78 | __count_vm_event(BALLOON_DEFLATE); | ||
77 | spin_unlock_irqrestore(&b_dev_info->pages_lock, flags); | 79 | spin_unlock_irqrestore(&b_dev_info->pages_lock, flags); |
78 | unlock_page(page); | 80 | unlock_page(page); |
79 | dequeued_page = true; | 81 | dequeued_page = true; |
diff --git a/mm/vmstat.c b/mm/vmstat.c index e9ab104b956f..cce7c766da7a 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -735,7 +735,7 @@ static void walk_zones_in_node(struct seq_file *m, pg_data_t *pgdat, | |||
735 | TEXT_FOR_HIGHMEM(xx) xx "_movable", | 735 | TEXT_FOR_HIGHMEM(xx) xx "_movable", |
736 | 736 | ||
737 | const char * const vmstat_text[] = { | 737 | const char * const vmstat_text[] = { |
738 | /* Zoned VM counters */ | 738 | /* enum zone_stat_item countes */ |
739 | "nr_free_pages", | 739 | "nr_free_pages", |
740 | "nr_alloc_batch", | 740 | "nr_alloc_batch", |
741 | "nr_inactive_anon", | 741 | "nr_inactive_anon", |
@@ -778,10 +778,13 @@ const char * const vmstat_text[] = { | |||
778 | "workingset_nodereclaim", | 778 | "workingset_nodereclaim", |
779 | "nr_anon_transparent_hugepages", | 779 | "nr_anon_transparent_hugepages", |
780 | "nr_free_cma", | 780 | "nr_free_cma", |
781 | |||
782 | /* enum writeback_stat_item counters */ | ||
781 | "nr_dirty_threshold", | 783 | "nr_dirty_threshold", |
782 | "nr_dirty_background_threshold", | 784 | "nr_dirty_background_threshold", |
783 | 785 | ||
784 | #ifdef CONFIG_VM_EVENT_COUNTERS | 786 | #ifdef CONFIG_VM_EVENT_COUNTERS |
787 | /* enum vm_event_item counters */ | ||
785 | "pgpgin", | 788 | "pgpgin", |
786 | "pgpgout", | 789 | "pgpgout", |
787 | "pswpin", | 790 | "pswpin", |
@@ -860,6 +863,13 @@ const char * const vmstat_text[] = { | |||
860 | "thp_zero_page_alloc", | 863 | "thp_zero_page_alloc", |
861 | "thp_zero_page_alloc_failed", | 864 | "thp_zero_page_alloc_failed", |
862 | #endif | 865 | #endif |
866 | #ifdef CONFIG_MEMORY_BALLOON | ||
867 | "balloon_inflate", | ||
868 | "balloon_deflate", | ||
869 | #ifdef CONFIG_BALLOON_COMPACTION | ||
870 | "balloon_migrate", | ||
871 | #endif | ||
872 | #endif /* CONFIG_MEMORY_BALLOON */ | ||
863 | #ifdef CONFIG_DEBUG_TLBFLUSH | 873 | #ifdef CONFIG_DEBUG_TLBFLUSH |
864 | #ifdef CONFIG_SMP | 874 | #ifdef CONFIG_SMP |
865 | "nr_tlb_remote_flush", | 875 | "nr_tlb_remote_flush", |