From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Andrew Morton <akpm@linux-foundation.org>,
Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
Tang Chen <tangchen@cn.fujitsu.com>,
Vlastimil Babka <vbabka@suse.cz>,
David Rientjes <rientjes@google.com>,
Fabian Frederick <fabf@skynet.be>,
Zhang Zhen <zhenzhang.zhang@huawei.com>,
Vladimir Davydov <vdavydov@parallels.com>,
Wang Nan <wangnan0@huawei.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
devel@linuxdriverproject.org, linux-mm@kvack.org
Subject: [PATCH RESEND 2/3] memory_hotplug: add note about holding device_hotplug_lock and add_memory()
Date: Thu, 12 Feb 2015 11:23:53 +0100 [thread overview]
Message-ID: <1423736634-338-3-git-send-email-vkuznets@redhat.com> (raw)
In-Reply-To: <1423736634-338-1-git-send-email-vkuznets@redhat.com>
add_memory() is supposed to be run with device_hotplug_lock grabbed, otherwise
it can race with e.g. device_online(). ACPI memory hotplug does that already
but e.g. Hyper-V ballooning driver doesn't.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
mm/memory_hotplug.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 9fab107..41638eb 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1213,7 +1213,11 @@ int zone_for_memory(int nid, u64 start, u64 size, int zone_default)
return zone_default;
}
-/* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */
+/*
+ * NOTE: The caller must call lock_device_hotplug() to serialize hotplug
+ * and online/offline operations before this call.
+ * We are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG.
+ */
int __ref add_memory(int nid, u64 start, u64 size)
{
pg_data_t *pgdat = NULL;
--
1.9.3
--
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:[~2015-02-12 10:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 10:23 [PATCH RESEND 0/3] memory_hotplug: hyperv: fix deadlock between memory adding and onlining Vitaly Kuznetsov
2015-02-12 10:23 ` [PATCH RESEND 1/3] driver core: export lock_device_hotplug/unlock_device_hotplug Vitaly Kuznetsov
2015-02-12 10:23 ` Vitaly Kuznetsov [this message]
2015-02-12 10:23 ` [PATCH RESEND 3/3] Drivers: hv: balloon: fix deadlock between memory adding and onlining Vitaly Kuznetsov
2015-02-12 15:38 ` [PATCH RESEND 0/3] memory_hotplug: hyperv: " KY Srinivasan
2015-02-12 15:50 ` Vitaly Kuznetsov
2015-02-12 17:40 ` KY Srinivasan
2015-02-12 22:12 ` Rafael J. Wysocki
2015-02-12 22:01 ` KY Srinivasan
2015-02-12 22:27 ` Rafael J. Wysocki
2015-02-12 22:10 ` KY Srinivasan
2015-02-12 22:43 ` Rafael J. Wysocki
2015-02-12 22:25 ` Andrew Morton
2015-03-06 15:50 ` Michal Hocko
2015-03-09 8:40 ` Vitaly Kuznetsov
2015-03-12 16:18 ` Michal Hocko
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=1423736634-338-3-git-send-email-vkuznets@redhat.com \
--to=vkuznets@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=devel@linuxdriverproject.org \
--cc=fabf@skynet.be \
--cc=gregkh@linuxfoundation.org \
--cc=haiyangz@microsoft.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=rjw@rjwysocki.net \
--cc=tangchen@cn.fujitsu.com \
--cc=vbabka@suse.cz \
--cc=vdavydov@parallels.com \
--cc=wangnan0@huawei.com \
--cc=zhenzhang.zhang@huawei.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