From: Wei Yang <richard.weiyang@gmail.com>
To: David Hildenbrand <david@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Oscar Salvador <osalvador@suse.de>,
	Michal Hocko <mhocko@suse.com>,
	Pavel Tatashin <pasha.tatashin@soleen.com>,
	Wei Yang <richard.weiyang@gmail.com>, Qian Cai <cai@lca.pw>,
	Arun KS <arunks@codeaurora.org>,
	Mathieu Malaterre <malat@debian.org>
Subject: Re: [PATCH] mm/memory_hotplug: Drop memory device reference after find_memory_block()
Date: Wed, 10 Apr 2019 22:24:13 +0000	[thread overview]
Message-ID: <20190410222413.4ljc2tchgkbl4lbo@master> (raw)
In-Reply-To: <20190410101455.17338-1-david@redhat.com>
On Wed, Apr 10, 2019 at 12:14:55PM +0200, David Hildenbrand wrote:
>While current node handling is probably terribly broken for memory block
>devices that span several nodes (only possible when added during boot,
>and something like that should be blocked completely), properly put the
>device reference we obtained via find_memory_block() to get the nid.
>
>Fixes: d0dc12e86b31 ("mm/memory_hotplug: optimize memory hotplug")
>Cc: Andrew Morton <akpm@linux-foundation.org>
>Cc: Oscar Salvador <osalvador@suse.de>
>Cc: Michal Hocko <mhocko@suse.com>
>Cc: David Hildenbrand <david@redhat.com>
>Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
>Cc: Wei Yang <richard.weiyang@gmail.com>
>Cc: Qian Cai <cai@lca.pw>
>Cc: Arun KS <arunks@codeaurora.org>
>Cc: Mathieu Malaterre <malat@debian.org>
>Signed-off-by: David Hildenbrand <david@redhat.com>
You are right.
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
>---
> mm/memory_hotplug.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>index 5eb4a4c7c21b..328878b6799d 100644
>--- a/mm/memory_hotplug.c
>+++ b/mm/memory_hotplug.c
>@@ -854,6 +854,7 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ
> 	 */
> 	mem = find_memory_block(__pfn_to_section(pfn));
> 	nid = mem->nid;
>+	put_device(&mem->dev);
> 
> 	/* associate pfn range with the zone */
> 	zone = move_pfn_range(online_type, nid, pfn, nr_pages);
>-- 
>2.20.1
-- 
Wei Yang
Help you, Help me
next prev parent reply	other threads:[~2019-04-10 22:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 10:14 [PATCH] mm/memory_hotplug: Drop memory device reference after find_memory_block() David Hildenbrand
2019-04-10 12:28 ` Oscar Salvador
2019-04-10 12:48   ` David Hildenbrand
2019-04-10 22:24 ` Wei Yang [this message]
2019-04-11  8:41 ` Michal Hocko
2019-04-11  9:11   ` David Hildenbrand
2019-04-11 10:56     ` Michal Hocko
2019-04-11 11:18       ` David Hildenbrand
2019-04-11 11:32         ` 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=20190410222413.4ljc2tchgkbl4lbo@master \
    --to=richard.weiyang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arunks@codeaurora.org \
    --cc=cai@lca.pw \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=malat@debian.org \
    --cc=mhocko@suse.com \
    --cc=osalvador@suse.de \
    --cc=pasha.tatashin@soleen.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;
as well as URLs for NNTP newsgroup(s).