[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130611130042.3dec2cc6737f21180bc09bb1@linux-foundation.org>
Date: Tue, 11 Jun 2013 13:00:42 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Jiang Liu <liuj97@...il.com>
Cc: Jiang Liu <jiang.liu@...wei.com>,
David Rientjes <rientjes@...gle.com>,
Wen Congyang <wency@...fujitsu.com>,
Mel Gorman <mgorman@...e.de>, Minchan Kim <minchan@...nel.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Michal Hocko <mhocko@...e.cz>,
James Bottomley <James.Bottomley@...senPartnership.com>,
Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
David Howells <dhowells@...hat.com>,
Mark Salter <msalter@...hat.com>,
Jianguo Wu <wujianguo@...wei.com>, linux-mm@...ck.org,
linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
Michel Lespinasse <walken@...gle.com>,
Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH v8, part3 10/14] mm: use a dedicated lock to protect
totalram_pages and zone->managed_pages
On Sun, 26 May 2013 21:38:38 +0800 Jiang Liu <liuj97@...il.com> wrote:
> Currently lock_memory_hotplug()/unlock_memory_hotplug() are used to
> protect totalram_pages and zone->managed_pages. Other than the memory
> hotplug driver, totalram_pages and zone->managed_pages may also be
> modified at runtime by other drivers, such as Xen balloon,
> virtio_balloon etc. For those cases, memory hotplug lock is a little
> too heavy, so introduce a dedicated lock to protect totalram_pages
> and zone->managed_pages.
>
> Now we have a simplified locking rules totalram_pages and
> zone->managed_pages as:
> 1) no locking for read accesses because they are unsigned long.
> 2) no locking for write accesses at boot time in single-threaded context.
> 3) serialize write accesses at runtime by acquiring the dedicated
> managed_page_count_lock.
>
> Also adjust zone->managed_pages when freeing reserved pages into the
> buddy system, to keep totalram_pages and zone->managed_pages in
> consistence.
>
> ...
>
> +void adjust_managed_page_count(struct page *page, long count)
> +{
> + spin_lock(&managed_page_count_lock);
> + page_zone(page)->managed_pages += count;
> + totalram_pages += count;
> + spin_unlock(&managed_page_count_lock);
> +}
> +EXPORT_SYMBOL(adjust_managed_page_count);
This is exported to modules but there are no modular callers at this
time.
I assume this was done for some forthcoming xen/virtio_balloon/etc
patches? If so, it would be better to avoid adding the export until it
is actually needed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists