mm: kill is_memblock_offlined()
Subsystems (3)
PATCH 1/1 mm: kill is_memblock_offlined()
Directly check state of struct memory_block, no need a single function.
Signed-off-by Kefeng Wang <[email protected]>
--- drivers/base/memory.c | 6 ------ include/linux/memory_hotplug.h | 2 -- mm/memory_hotplug.c | 3 +-- 3 files changed, 1 insertion(+), 10 deletions(-)
drivers/base/memory.c +0 -6
@@ -869,12 +869,6 @@ void remove_memory_block_devices(unsigned long start, unsigned long size) } } -/* return true if the memory block is offlined, otherwise, return false */ -bool is_memblock_offlined (struct memory_block *mem) -{ -return mem->state ==MEM_OFFLINE ; -} -static struct attribute *memory_root_attrs[] = { #ifdef CONFIG_ARCH_MEMORY_PROBE &dev_attr_probe.attr,
include/linux/memory_hotplug.h +0 -2
@@ -11,7 +11,6 @@ struct page;struct zone ;struct pglist_data ;struct mem_section ; -struct memory_block ;struct memory_group ;struct resource ;struct vmem_altmap ;
@@ -352,7 +351,6 @@ extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,extern void remove_pfn_range_from_zone (struct zone *zone,unsigned long start_pfn,unsigned long nr_pages); -extern bool is_memblock_offlined (struct memory_block *mem);extern int sparse_add_section (int nid,unsigned long pfn,unsigned long nr_pages,struct vmem_altmap *altmap,struct dev_pagemap *pgmap);
mm/memory_hotplug.c +1 -2
@@ -1969,11 +1969,10 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages,static int check_memblock_offlined_cb (struct memory_block *mem,void *arg) { -int ret = !is_memblock_offlined (mem);int *nid = arg; *nid = mem->nid; -if (unlikely (ret)) { +if (unlikely (mem->state !=MEM_OFFLINE )) {phys_addr_t beginpa, endpa; beginpa =PFN_PHYS (section_nr_to_pfn (mem->start_section_nr));
Signature · 1 line
2.35.3
Quoted 53 lines · Kefeng Wang
Directly check state of struct
memory_block, no need a single function.Signed-off-by Kefeng Wang <[email protected]>--- drivers/base/memory.c | 6 ------ include/linux/memory_hotplug.h | 2 -- mm/memory_hotplug.c | 3 +-- 3 files changed, 1 insertion(+), 10 deletions(-)drivers/base/memory.c +0
-6@@ -869,12 +869,6 @@ void remove_memory_block_devices(unsigned long start, unsigned long size) } } -/* return true if the memory block is offlined, otherwise, return false */ -bool is_memblock_offlined (struct memory_block *mem) -{ -return mem->state ==MEM_OFFLINE ; -} -static struct attribute *memory_root_attrs[] = { #ifdef CONFIG_ARCH_MEMORY_PROBE &dev_attr_probe.attr,include/linux/memory_hotplug.h +0
-2@@ -11,7 +11,6 @@ struct page;struct zone ;struct pglist_data ;struct mem_section ; -struct memory_block ;struct memory_group ;struct resource ;struct vmem_altmap ;@@ -352,7 +351,6 @@ extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,extern void remove_pfn_range_from_zone (struct zone *zone,unsigned long start_pfn,unsigned long nr_pages); -extern bool is_memblock_offlined (struct memory_block *mem);extern int sparse_add_section (int nid,unsigned long pfn,unsigned long nr_pages,struct vmem_altmap *altmap,struct dev_pagemap *pgmap);mm/memory_hotplug.c +0
-0@@ -1969,11 +1969,10 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages,static int check_memblock_offlined_cb (struct memory_block *mem,void *arg)
mm/memory_hotplug.c int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages, · line 1978
Quoted 10 lines
mm/memory_hotplug.c +1
-2{ -int ret = !is_memblock_offlined (mem);int *nid = arg; *nid = mem->nid; -if (unlikely (ret)) { +if (unlikely (mem->state !=MEM_OFFLINE )) {phys_addr_t beginpa, endpa; beginpa =PFN_PHYS (section_nr_to_pfn (mem->start_section_nr));
Reviewed-by David Hildenbrand <[email protected]>
Signature · 3 lines
Thanks, David / dhildenb
Quoted 3 lines · Kefeng Wang
Directly check state of struct
memory_block, no need a single function.Signed-off-by Kefeng Wang <[email protected]>
Reviewed-by Oscar Salvador <[email protected]>
Signature · 2 lines
Oscar Salvador SUSE Labs
Quoted 4 lines · Kefeng Wang
Directly check state of struct
memory_block, no need a single function.Signed-off-by Kefeng Wang <[email protected]>---
Reviewed-by Anshuman Khandual <[email protected]>
Quoted 59 lines
drivers/base/memory.c | 6 ------ include/linux/memory_hotplug.h | 2 -- mm/memory_hotplug.c | 3 +-- 3 files changed, 1 insertion(+), 10 deletions(-)drivers/base/memory.c +0
-6@@ -869,12 +869,6 @@ void remove_memory_block_devices(unsigned long start, unsigned long size) } } -/* return true if the memory block is offlined, otherwise, return false */ -bool is_memblock_offlined (struct memory_block *mem) -{ -return mem->state ==MEM_OFFLINE ; -} -static struct attribute *memory_root_attrs[] = { #ifdef CONFIG_ARCH_MEMORY_PROBE &dev_attr_probe.attr,include/linux/memory_hotplug.h +0
-2@@ -11,7 +11,6 @@ struct page;struct zone ;struct pglist_data ;struct mem_section ; -struct memory_block ;struct memory_group ;struct resource ;struct vmem_altmap ;@@ -352,7 +351,6 @@ extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,extern void remove_pfn_range_from_zone (struct zone *zone,unsigned long start_pfn,unsigned long nr_pages); -extern bool is_memblock_offlined (struct memory_block *mem);extern int sparse_add_section (int nid,unsigned long pfn,unsigned long nr_pages,struct vmem_altmap *altmap,struct dev_pagemap *pgmap);mm/memory_hotplug.c +1
-2@@ -1969,11 +1969,10 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages,static int check_memblock_offlined_cb (struct memory_block *mem,void *arg) { -int ret = !is_memblock_offlined (mem);int *nid = arg; *nid = mem->nid; -if (unlikely (ret)) { +if (unlikely (mem->state !=MEM_OFFLINE )) {phys_addr_t beginpa, endpa; beginpa =PFN_PHYS (section_nr_to_pfn (mem->start_section_nr));