[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5162C887.5070900@redhat.com>
Date: Mon, 08 Apr 2013 09:39:19 -0400
From: Rik van Riel <riel@...hat.com>
To: Jiang Liu <liuj97@...il.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
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>
Subject: Re: [PATCH v4, part3 11/15] mm: use a dedicated lock to protect totalram_pages
and zone->managed_pages
On 04/06/2013 09:55 AM, Jiang Liu wrote:
> @@ -5186,6 +5189,22 @@ early_param("movablecore", cmdline_parse_movablecore);
>
> #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
>
> +void adjust_managed_page_count(struct page *page, long count)
> +{
> + bool lock = (system_state != SYSTEM_BOOTING);
> +
> + /* No need to acquire the lock during boot */
> + if (lock)
> + spin_lock(&managed_page_count_lock);
> +
> + page_zone(page)->managed_pages += count;
> + totalram_pages += count;
> +
> + if (lock)
> + spin_unlock(&managed_page_count_lock);
> +}
While I agree the boot code currently does not need the lock, is
there any harm to removing that conditional?
That would simplify the code, and protect against possible future
cleverness of initializing multiple memory things simultaneously.
--
All rights reversed
--
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