From: Andrew Morton <akpm@linux-foundation.org>
To: Cody P Schafer <cody@linux.vnet.ibm.com>
Cc: David Rientjes <rientjes@google.com>,
Linux MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 3/4] memory_hotplug: use pgdat_resize_lock() in online_pages()
Date: Wed, 15 May 2013 16:20:54 -0700 [thread overview]
Message-ID: <20130515162054.1c76200ee9514ca8a2054628@linux-foundation.org> (raw)
In-Reply-To: <1368486787-9511-4-git-send-email-cody@linux.vnet.ibm.com>
On Mon, 13 May 2013 16:13:06 -0700 Cody P Schafer <cody@linux.vnet.ibm.com> wrote:
> mmzone.h documents node_size_lock (which pgdat_resize_lock() locks) as
> follows:
>
> * Must be held any time you expect node_start_pfn, node_present_pages
> * or node_spanned_pages stay constant. [...]
Yeah, I suppose so. Although no present code sites actually do that.
> So actually hold it when we update node_present_pages in online_pages().
>
> ...
>
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -915,6 +915,7 @@ static void node_states_set_node(int node, struct memory_notify *arg)
>
> int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_type)
> {
> + unsigned long flags;
> unsigned long onlined_pages = 0;
> struct zone *zone;
> int need_zonelists_rebuild = 0;
> @@ -993,7 +994,11 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ
>
> zone->managed_pages += onlined_pages;
> zone->present_pages += onlined_pages;
> +
> + pgdat_resize_lock(zone->zone_pgdat, &flags);
> zone->zone_pgdat->node_present_pages += onlined_pages;
> + pgdat_resize_unlock(zone->zone_pgdat, &flags);
> +
> if (onlined_pages) {
> node_states_set_node(zone_to_nid(zone), &arg);
> if (need_zonelists_rebuild)
afaict the only benefits of making this change are
a) so that code which does
a = p->node_present_pages;
...
b = p->node_present_pages;
can ensure that `a' and `b' are equal, by taking pgdat_resize_lock().
Which is somewhat odd, and
b) to make the comment truthful ;)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2013-05-15 23:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-13 23:13 [PATCH v3 0/4] misc patches related to resizing nodes & zones Cody P Schafer
2013-05-13 23:13 ` [PATCH v3 1/4] mm: fix comment referring to non-existent size_seqlock, change to span_seqlock Cody P Schafer
2013-05-13 23:13 ` [PATCH v3 2/4] mmzone: note that node_size_lock should be manipulated via pgdat_resize_lock() Cody P Schafer
2013-05-13 23:13 ` [PATCH v3 3/4] memory_hotplug: use pgdat_resize_lock() in online_pages() Cody P Schafer
2013-05-15 23:20 ` Andrew Morton [this message]
2013-05-16 21:05 ` David Rientjes
2013-05-13 23:13 ` [PATCH v3 4/4] memory_hotplug: use pgdat_resize_lock() in __offline_pages() Cody P Schafer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130515162054.1c76200ee9514ca8a2054628@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=cody@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox