Skip to content

Commit e5d709b

Browse files
heicarstMartin Schwidefsky
authored andcommitted
s390/memory hotplug: provide memory_block_size_bytes() function
Commit 0c2c99b "memory hotplug: Allow memory blocks to span multiple memory sections" introduced a weak memory_block_size_bytes() function which can be used to set the size of a memory block as seen in sysfs. Provide an s390 specific override which makes sure that each memory block has at least a size of 256MB or the increment size of of a memory increment, whatever is larger. This way we can make sure that the number of memory sysfs objects doesn't explode for very large memory configurations. Reported-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent df1bd59 commit e5d709b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎arch/s390/mm/init.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/init.h>
2222
#include <linux/pagemap.h>
2323
#include <linux/bootmem.h>
24+
#include <linux/memory.h>
2425
#include <linux/pfn.h>
2526
#include <linux/poison.h>
2627
#include <linux/initrd.h>
@@ -36,6 +37,7 @@
3637
#include <asm/tlbflush.h>
3738
#include <asm/sections.h>
3839
#include <asm/ctl_reg.h>
40+
#include <asm/sclp.h>
3941

4042
pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE)));
4143

@@ -214,6 +216,15 @@ int arch_add_memory(int nid, u64 start, u64 size)
214216
return rc;
215217
}
216218

219+
unsigned long memory_block_size_bytes(void)
220+
{
221+
/*
222+
* Make sure the memory block size is always greater
223+
* or equal than the memory increment size.
224+
*/
225+
return max_t(unsigned long, MIN_MEMORY_BLOCK_SIZE, sclp_get_rzm());
226+
}
227+
217228
#ifdef CONFIG_MEMORY_HOTREMOVE
218229
int arch_remove_memory(u64 start, u64 size)
219230
{

0 commit comments

Comments
 (0)