+ mm-memory_hotplug-drop-memory-device-reference-after-find_memory_block.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/memory_hotplug.c: drop memory device reference after find_memory_block()
has been added to the -mm tree.  Its filename is
     mm-memory_hotplug-drop-memory-device-reference-after-find_memory_block.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-memory_hotplug-drop-memory-device-reference-after-find_memory_block.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-memory_hotplug-drop-memory-device-reference-after-find_memory_block.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: David Hildenbrand <david@xxxxxxxxxx>
Subject: mm/memory_hotplug.c: drop memory device reference after find_memory_block()

Right now we are using find_memory_block() to get the node id for the pfn
range to online.  We are missing to drop a reference to the memory block
device.  While the device still gets unregistered via device_unregister(),
resulting in no user visible problem, the device is never released via
device_release(), resulting in a memory leak.  Fix that by properly using
a put_device().

Link: http://lkml.kernel.org/r/20190411110955.1430-1-david@xxxxxxxxxx
Fixes: d0dc12e86b31 ("mm/memory_hotplug: optimize memory hotplug")
Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
Reviewed-by: Oscar Salvador <osalvador@xxxxxxx>
Reviewed-by: Wei Yang <richard.weiyang@xxxxxxxxx>
Acked-by: Michal Hocko <mhocko@xxxxxxxx>
Acked-by: Pankaj Gupta <pagupta@xxxxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>
Cc: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx>
Cc: Qian Cai <cai@xxxxxx>
Cc: Arun KS <arunks@xxxxxxxxxxxxxx>
Cc: Mathieu Malaterre <malat@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/memory_hotplug.c |    1 +
 1 file changed, 1 insertion(+)

--- a/mm/memory_hotplug.c~mm-memory_hotplug-drop-memory-device-reference-after-find_memory_block
+++ a/mm/memory_hotplug.c
@@ -874,6 +874,7 @@ int __ref online_pages(unsigned long pfn
 	 */
 	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);
_

Patches currently in -mm which might be from david@xxxxxxxxxx are

mm-memory_hotplug-drop-memory-device-reference-after-find_memory_block.patch
mm-balloon-drop-unused-function-stubs.patch
mm-memory_hotplug-release-memory-resource-after-arch_remove_memory.patch
mm-memory_hotplug-make-unregister_memory_section-never-fail.patch
mm-memory_hotplug-make-__remove_section-never-fail.patch
mm-memory_hotplug-make-__remove_pages-and-arch_remove_memory-never-fail.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux