Thread (47 messages) 47 messages, 6 authors, 2013-02-07

Re: [PATCH v5 04/14] memory-hotplug: remove /sys/firmware/memmap/X sysfs

From: Kamezawa Hiroyuki <hidden>
Date: 2012-12-26 03:31:53
Also in: linux-acpi, linux-mm, linux-s390, linuxppc-dev, lkml, sparclinux

(2012/12/24 21:09), Tang Chen wrote:
quoted hunk ↗ jump to hunk
From: Yasuaki Ishimatsu <redacted>

When (hot)adding memory into system, /sys/firmware/memmap/X/{end, start, type}
sysfs files are created. But there is no code to remove these files. The patch
implements the function to remove them.

Note: The code does not free firmware_map_entry which is allocated by bootmem.
       So the patch makes memory leak. But I think the memory leak size is
       very samll. And it does not affect the system.

Signed-off-by: Wen Congyang <redacted>
Signed-off-by: Yasuaki Ishimatsu <redacted>
---
  drivers/firmware/memmap.c    |   98 +++++++++++++++++++++++++++++++++++++++++-
  include/linux/firmware-map.h |    6 +++
  mm/memory_hotplug.c          |    5 ++-
  3 files changed, 106 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
index 90723e6..49be12a 100644
--- a/drivers/firmware/memmap.c
+++ b/drivers/firmware/memmap.c
@@ -21,6 +21,7 @@
  #include <linux/types.h>
  #include <linux/bootmem.h>
  #include <linux/slab.h>
+#include <linux/mm.h>
  
  /*
   * Data types ------------------------------------------------------------------
@@ -41,6 +42,7 @@ struct firmware_map_entry {
  	const char		*type;	/* type of the memory range */
  	struct list_head	list;	/* entry for the linked list */
  	struct kobject		kobj;   /* kobject for each entry */
+	unsigned int		bootmem:1; /* allocated from bootmem */
  };
Can't we detect from which the object is allocated from, slab or bootmem ?

Hm, for example,

    PageReserved(virt_to_page(address_of_obj)) ?
    PageSlab(virt_to_page(address_of_obj)) ?

Thanks,
-Kame
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help