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-s390, linux-sh, 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
--
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>