Re: [PATCH v2 2/9] mm/memory_hotplug: introduce "auto-movable" online policy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



+struct auto_movable_stats {
+	unsigned long kernel_early_pages;
+	unsigned long movable_pages;
+};
+
+static void auto_movable_stats_account_zone(struct auto_movable_stats *stats,
+					    struct zone *zone)
+{
+	if (zone_idx(zone) == ZONE_MOVABLE) {
+		stats->movable_pages += zone->present_pages;
+	} else {
+		/*
+		 * CMA pages (never on hotplugged memory) behave like
+		 * ZONE_MOVABLE.
+		 */
+		stats->movable_pages += zone->cma_pages;
+		stats->kernel_early_pages += zone->present_early_pages;
+		stats->kernel_early_pages -= zone->cma_pages;
+	}
+}

The following on top to make it compile without CONFIG_CMA (thanks Randy):

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index bfdaa28eb86f..fa1a0afd32ba 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -741,13 +741,15 @@ static void auto_movable_stats_account_zone(struct auto_movable_stats *stats,
        if (zone_idx(zone) == ZONE_MOVABLE) {
                stats->movable_pages += zone->present_pages;
        } else {
+               stats->kernel_early_pages += zone->present_early_pages;
+#ifdef CONFIG_CMA
                /*
                 * CMA pages (never on hotplugged memory) behave like
                 * ZONE_MOVABLE.
                 */
                stats->movable_pages += zone->cma_pages;
-               stats->kernel_early_pages += zone->present_early_pages;
                stats->kernel_early_pages -= zone->cma_pages;
+#endif /* CONFIG_CMA */
        }
 }
 struct auto_movable_group_stats {



--
Thanks,

David / dhildenb





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux