From: Cody P Schafer <cody@linux.vnet.ibm.com>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linux MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/4] memory_hotplug: use pgdat_resize_lock() when updating node_present_pages
Date: Wed, 01 May 2013 15:41:02 -0700 [thread overview]
Message-ID: <518199FE.7060908@linux.vnet.ibm.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1305011530050.8804@chino.kir.corp.google.com>
On 05/01/2013 03:30 PM, David Rientjes wrote:
> On Wed, 1 May 2013, Cody P Schafer wrote:
>
>> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>> index a221fac..0bdca10 100644
>> --- 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)
>
> Why? You can't get a partial read of a word-sized data structure.
>
Guaranteed to be stable means that if I'm a reader and
pgdat_resize_lock(), node_present_pages had better not change at all
until I pgdat_resize_unlock().
If nothing needs this guarantee, we should change the rules of
pgdat_resize_lock(). I played it safe and went with following the
existing rules.
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Cody P Schafer <cody@linux.vnet.ibm.com>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linux MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/4] memory_hotplug: use pgdat_resize_lock() when updating node_present_pages
Date: Wed, 01 May 2013 15:41:02 -0700 [thread overview]
Message-ID: <518199FE.7060908@linux.vnet.ibm.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1305011530050.8804@chino.kir.corp.google.com>
On 05/01/2013 03:30 PM, David Rientjes wrote:
> On Wed, 1 May 2013, Cody P Schafer wrote:
>
>> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>> index a221fac..0bdca10 100644
>> --- 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)
>
> Why? You can't get a partial read of a word-sized data structure.
>
Guaranteed to be stable means that if I'm a reader and
pgdat_resize_lock(), node_present_pages had better not change at all
until I pgdat_resize_unlock().
If nothing needs this guarantee, we should change the rules of
pgdat_resize_lock(). I played it safe and went with following the
existing rules.
next prev parent reply other threads:[~2013-05-01 22:41 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-01 22:17 [PATCH 0/4] misc patches related to resizing nodes & zones Cody P Schafer
2013-05-01 22:17 ` Cody P Schafer
2013-05-01 22:17 ` [PATCH 1/4] mmzone: make holding lock_memory_hotplug() a requirement for updating pgdat size Cody P Schafer
2013-05-01 22:17 ` Cody P Schafer
2013-05-01 22:26 ` David Rientjes
2013-05-01 22:26 ` David Rientjes
2013-05-01 22:32 ` Cody P Schafer
2013-05-01 22:32 ` Cody P Schafer
2013-05-01 22:39 ` David Rientjes
2013-05-01 22:39 ` David Rientjes
2013-05-01 22:45 ` Cody P Schafer
2013-05-01 22:45 ` Cody P Schafer
2013-05-01 22:17 ` [PATCH 2/4] mm: fix comment referring to non-existent size_seqlock, change to span_seqlock Cody P Schafer
2013-05-01 22:17 ` Cody P Schafer
2013-05-01 22:27 ` David Rientjes
2013-05-01 22:27 ` David Rientjes
2013-05-01 22:17 ` [PATCH 3/4] mmzone: note that node_size_lock should be manipulated via pgdat_resize_lock() Cody P Schafer
2013-05-01 22:17 ` Cody P Schafer
2013-05-01 22:29 ` David Rientjes
2013-05-01 22:29 ` David Rientjes
2013-05-01 22:36 ` Cody P Schafer
2013-05-01 22:36 ` Cody P Schafer
2013-05-01 22:42 ` David Rientjes
2013-05-01 22:42 ` David Rientjes
2013-05-01 22:47 ` Cody P Schafer
2013-05-01 22:47 ` Cody P Schafer
2013-05-01 22:17 ` [PATCH 4/4] memory_hotplug: use pgdat_resize_lock() when updating node_present_pages Cody P Schafer
2013-05-01 22:17 ` Cody P Schafer
2013-05-01 22:30 ` David Rientjes
2013-05-01 22:30 ` David Rientjes
2013-05-01 22:41 ` Cody P Schafer [this message]
2013-05-01 22:41 ` Cody P Schafer
2013-05-01 22:48 ` David Rientjes
2013-05-01 22:48 ` David Rientjes
2013-05-01 22:51 ` Cody P Schafer
2013-05-01 22:51 ` 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=518199FE.7060908@linux.vnet.ibm.com \
--to=cody@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.