]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm: add vm event counters for balloon pages compaction
authorRafael Aquini <aquini@redhat.com>
Thu, 29 Nov 2012 03:17:26 +0000 (14:17 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 5 Dec 2012 05:23:10 +0000 (16:23 +1100)
Introduce a new set of vm event counters to keep track of ballooned pages
compaction activity.

Signed-off-by: Rafael Aquini <aquini@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/balloon_compaction.h
include/linux/vm_event_item.h
mm/balloon_compaction.c
mm/migrate.c
mm/vmstat.c

index 6d380e3a9f4e9f2a8026565b2fb08c1b9c03845e..634a19b2361333304c7b2c1e4980f7d2e0e69056 100644 (file)
@@ -214,8 +214,15 @@ static inline bool balloon_compaction_check(void)
        return true;
 }
 
+static inline void balloon_event_count(enum vm_event_item item)
+{
+       count_vm_event(item);
+}
 #else /* !CONFIG_BALLOON_COMPACTION */
 
+/* A macro, to avoid generating references to the undefined COMPACTBALLOON* */
+#define balloon_event_count(item) do { } while (0)
+
 static inline void *balloon_mapping_alloc(void *balloon_device,
                                const struct address_space_operations *a_ops)
 {
index 3d3114594370118addc16ee1156e9b19f6d97fef..bd67c3f79b4eddf4f5c6f89730c7d438fba11771 100644 (file)
@@ -41,7 +41,12 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
 #ifdef CONFIG_COMPACTION
                COMPACTBLOCKS, COMPACTPAGES, COMPACTPAGEFAILED,
                COMPACTSTALL, COMPACTFAIL, COMPACTSUCCESS,
-#endif
+#ifdef CONFIG_BALLOON_COMPACTION
+               COMPACTBALLOONISOLATED, /* isolated from balloon pagelist */
+               COMPACTBALLOONMIGRATED, /* balloon page sucessfully migrated */
+               COMPACTBALLOONRETURNED, /* putback to pagelist, not-migrated */
+#endif /* CONFIG_BALLOON_COMPACTION */
+#endif /* CONFIG_COMPACTION */
 #ifdef CONFIG_HUGETLB_PAGE
                HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
 #endif
index 07dbc8ec46cfb5bba7eff332a0950b9f1b9593e1..2c8ce496804f137b4420bcd652b2232e7c623723 100644 (file)
@@ -242,6 +242,7 @@ bool balloon_page_isolate(struct page *page)
                        if (__is_movable_balloon_page(page) &&
                            page_count(page) == 2) {
                                __isolate_balloon_page(page);
+                               balloon_event_count(COMPACTBALLOONISOLATED);
                                unlock_page(page);
                                return true;
                        }
@@ -265,6 +266,7 @@ void balloon_page_putback(struct page *page)
                __putback_balloon_page(page);
                /* drop the extra ref count taken for page isolation */
                put_page(page);
+               balloon_event_count(COMPACTBALLOONRETURNED);
        } else {
                WARN_ON(1);
                dump_page(page);
index 5fe7d8a6bf793c7c89776fc618a5a7b22fdb030a..b2f9a021ec1a8f6a184fe257e77bfbecc574747d 100644 (file)
@@ -884,6 +884,7 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
                dec_zone_page_state(page, NR_ISOLATED_ANON +
                                    page_is_file_cache(page));
                balloon_page_free(page);
+               balloon_event_count(COMPACTBALLOONMIGRATED);
                return MIGRATEPAGE_SUCCESS;
        }
 out:
index c7370579111b872943c56bd694dc0bd02121092d..18a76ea6d0126eafce97853706bb524ca911b34c 100644 (file)
@@ -781,7 +781,14 @@ const char * const vmstat_text[] = {
        "compact_stall",
        "compact_fail",
        "compact_success",
-#endif
+
+#ifdef CONFIG_BALLOON_COMPACTION
+       "compact_balloon_isolated",
+       "compact_balloon_migrated",
+       "compact_balloon_returned",
+#endif /* CONFIG_BALLOON_COMPACTION */
+
+#endif /* CONFIG_COMPACTION */
 
 #ifdef CONFIG_HUGETLB_PAGE
        "htlb_buddy_alloc_success",