Skip to content

Commit f5637d3

Browse files
lsgunthtorvalds
authored andcommitted
mm/memory_hotplug: rename mhp_restrictions to mhp_params
The mhp_restrictions struct really doesn't specify anything resembling a restriction anymore so rename it to be mhp_params as it is a list of extended parameters. Signed-off-by: Logan Gunthorpe <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Dan Williams <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Eric Badger <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Will Deacon <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 96c6b59 commit f5637d3

File tree

10 files changed

+33
-33
lines changed

10 files changed

+33
-33
lines changed

arch/arm64/mm/mmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ static void __remove_pgd_mapping(pgd_t *pgdir, unsigned long start, u64 size)
13741374
}
13751375

13761376
int arch_add_memory(int nid, u64 start, u64 size,
1377-
struct mhp_restrictions *restrictions)
1377+
struct mhp_params *params)
13781378
{
13791379
int ret, flags = 0;
13801380

@@ -1387,7 +1387,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
13871387
memblock_clear_nomap(start, size);
13881388

13891389
ret = __add_pages(nid, start >> PAGE_SHIFT, size >> PAGE_SHIFT,
1390-
restrictions);
1390+
params);
13911391
if (ret)
13921392
__remove_pgd_mapping(swapper_pg_dir,
13931393
__phys_to_virt(start), size);

arch/ia64/mm/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,13 +670,13 @@ mem_init (void)
670670

671671
#ifdef CONFIG_MEMORY_HOTPLUG
672672
int arch_add_memory(int nid, u64 start, u64 size,
673-
struct mhp_restrictions *restrictions)
673+
struct mhp_params *params)
674674
{
675675
unsigned long start_pfn = start >> PAGE_SHIFT;
676676
unsigned long nr_pages = size >> PAGE_SHIFT;
677677
int ret;
678678

679-
ret = __add_pages(nid, start_pfn, nr_pages, restrictions);
679+
ret = __add_pages(nid, start_pfn, nr_pages, params);
680680
if (ret)
681681
printk("%s: Problem encountered in __add_pages() as ret=%d\n",
682682
__func__, ret);

arch/powerpc/mm/mem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static void flush_dcache_range_chunked(unsigned long start, unsigned long stop,
122122
}
123123

124124
int __ref arch_add_memory(int nid, u64 start, u64 size,
125-
struct mhp_restrictions *restrictions)
125+
struct mhp_params *params)
126126
{
127127
unsigned long start_pfn = start >> PAGE_SHIFT;
128128
unsigned long nr_pages = size >> PAGE_SHIFT;
@@ -138,7 +138,7 @@ int __ref arch_add_memory(int nid, u64 start, u64 size,
138138
return -EFAULT;
139139
}
140140

141-
return __add_pages(nid, start_pfn, nr_pages, restrictions);
141+
return __add_pages(nid, start_pfn, nr_pages, params);
142142
}
143143

144144
void __ref arch_remove_memory(int nid, u64 start, u64 size,

arch/s390/mm/init.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,20 +268,20 @@ device_initcall(s390_cma_mem_init);
268268
#endif /* CONFIG_CMA */
269269

270270
int arch_add_memory(int nid, u64 start, u64 size,
271-
struct mhp_restrictions *restrictions)
271+
struct mhp_params *params)
272272
{
273273
unsigned long start_pfn = PFN_DOWN(start);
274274
unsigned long size_pages = PFN_DOWN(size);
275275
int rc;
276276

277-
if (WARN_ON_ONCE(restrictions->altmap))
277+
if (WARN_ON_ONCE(params->altmap))
278278
return -EINVAL;
279279

280280
rc = vmem_add_mapping(start, size);
281281
if (rc)
282282
return rc;
283283

284-
rc = __add_pages(nid, start_pfn, size_pages, restrictions);
284+
rc = __add_pages(nid, start_pfn, size_pages, params);
285285
if (rc)
286286
vmem_remove_mapping(start, size);
287287
return rc;

arch/sh/mm/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,14 @@ void __init mem_init(void)
406406

407407
#ifdef CONFIG_MEMORY_HOTPLUG
408408
int arch_add_memory(int nid, u64 start, u64 size,
409-
struct mhp_restrictions *restrictions)
409+
struct mhp_params *params)
410410
{
411411
unsigned long start_pfn = PFN_DOWN(start);
412412
unsigned long nr_pages = size >> PAGE_SHIFT;
413413
int ret;
414414

415415
/* We only have ZONE_NORMAL, so this is easy.. */
416-
ret = __add_pages(nid, start_pfn, nr_pages, restrictions);
416+
ret = __add_pages(nid, start_pfn, nr_pages, params);
417417
if (unlikely(ret))
418418
printk("%s: Failed, __add_pages() == %d\n", __func__, ret);
419419

arch/x86/mm/init_32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,12 +819,12 @@ void __init mem_init(void)
819819

820820
#ifdef CONFIG_MEMORY_HOTPLUG
821821
int arch_add_memory(int nid, u64 start, u64 size,
822-
struct mhp_restrictions *restrictions)
822+
struct mhp_params *params)
823823
{
824824
unsigned long start_pfn = start >> PAGE_SHIFT;
825825
unsigned long nr_pages = size >> PAGE_SHIFT;
826826

827-
return __add_pages(nid, start_pfn, nr_pages, restrictions);
827+
return __add_pages(nid, start_pfn, nr_pages, params);
828828
}
829829

830830
void arch_remove_memory(int nid, u64 start, u64 size,

arch/x86/mm/init_64.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,11 +843,11 @@ static void update_end_of_memory_vars(u64 start, u64 size)
843843
}
844844

845845
int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
846-
struct mhp_restrictions *restrictions)
846+
struct mhp_params *params)
847847
{
848848
int ret;
849849

850-
ret = __add_pages(nid, start_pfn, nr_pages, restrictions);
850+
ret = __add_pages(nid, start_pfn, nr_pages, params);
851851
WARN_ON_ONCE(ret);
852852

853853
/* update max_pfn, max_low_pfn and high_memory */
@@ -858,14 +858,14 @@ int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
858858
}
859859

860860
int arch_add_memory(int nid, u64 start, u64 size,
861-
struct mhp_restrictions *restrictions)
861+
struct mhp_params *params)
862862
{
863863
unsigned long start_pfn = start >> PAGE_SHIFT;
864864
unsigned long nr_pages = size >> PAGE_SHIFT;
865865

866866
init_memory_mapping(start, start + size);
867867

868-
return add_pages(nid, start_pfn, nr_pages, restrictions);
868+
return add_pages(nid, start_pfn, nr_pages, params);
869869
}
870870

871871
#define PAGE_INUSE 0xFD

include/linux/memory_hotplug.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ enum {
5858
};
5959

6060
/*
61-
* Restrictions for the memory hotplug:
62-
* altmap: alternative allocator for memmap array
61+
* Extended parameters for memory hotplug:
62+
* altmap: alternative allocator for memmap array (optional)
6363
*/
64-
struct mhp_restrictions {
64+
struct mhp_params {
6565
struct vmem_altmap *altmap;
6666
};
6767

@@ -112,7 +112,7 @@ extern int restore_online_page_callback(online_page_callback_t callback);
112112
extern int try_online_node(int nid);
113113

114114
extern int arch_add_memory(int nid, u64 start, u64 size,
115-
struct mhp_restrictions *restrictions);
115+
struct mhp_params *params);
116116
extern u64 max_mem_size;
117117

118118
extern int memhp_online_type_from_str(const char *str);
@@ -133,17 +133,17 @@ extern void __remove_pages(unsigned long start_pfn, unsigned long nr_pages,
133133

134134
/* reasonably generic interface to expand the physical pages */
135135
extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
136-
struct mhp_restrictions *restrictions);
136+
struct mhp_params *params);
137137

138138
#ifndef CONFIG_ARCH_HAS_ADD_PAGES
139139
static inline int add_pages(int nid, unsigned long start_pfn,
140-
unsigned long nr_pages, struct mhp_restrictions *restrictions)
140+
unsigned long nr_pages, struct mhp_params *params)
141141
{
142-
return __add_pages(nid, start_pfn, nr_pages, restrictions);
142+
return __add_pages(nid, start_pfn, nr_pages, params);
143143
}
144144
#else /* ARCH_HAS_ADD_PAGES */
145145
int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
146-
struct mhp_restrictions *restrictions);
146+
struct mhp_params *params);
147147
#endif /* ARCH_HAS_ADD_PAGES */
148148

149149
#ifdef CONFIG_NUMA

mm/memory_hotplug.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,12 @@ static int check_hotplug_memory_addressable(unsigned long pfn,
304304
* add the new pages.
305305
*/
306306
int __ref __add_pages(int nid, unsigned long pfn, unsigned long nr_pages,
307-
struct mhp_restrictions *restrictions)
307+
struct mhp_params *params)
308308
{
309309
const unsigned long end_pfn = pfn + nr_pages;
310310
unsigned long cur_nr_pages;
311311
int err;
312-
struct vmem_altmap *altmap = restrictions->altmap;
312+
struct vmem_altmap *altmap = params->altmap;
313313

314314
err = check_hotplug_memory_addressable(pfn, nr_pages);
315315
if (err)
@@ -1002,7 +1002,7 @@ static int online_memory_block(struct memory_block *mem, void *arg)
10021002
*/
10031003
int __ref add_memory_resource(int nid, struct resource *res)
10041004
{
1005-
struct mhp_restrictions restrictions = {};
1005+
struct mhp_params params = {};
10061006
u64 start, size;
10071007
bool new_node = false;
10081008
int ret;
@@ -1030,7 +1030,7 @@ int __ref add_memory_resource(int nid, struct resource *res)
10301030
new_node = ret;
10311031

10321032
/* call arch's memory hotadd */
1033-
ret = arch_add_memory(nid, start, size, &restrictions);
1033+
ret = arch_add_memory(nid, start, size, &params);
10341034
if (ret < 0)
10351035
goto error;
10361036

mm/memremap.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
184184
{
185185
struct resource *res = &pgmap->res;
186186
struct dev_pagemap *conflict_pgmap;
187-
struct mhp_restrictions restrictions = {
187+
struct mhp_params params = {
188188
/*
189189
* We do not want any optional features only our own memmap
190190
*/
@@ -302,7 +302,7 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
302302
*/
303303
if (pgmap->type == MEMORY_DEVICE_PRIVATE) {
304304
error = add_pages(nid, PHYS_PFN(res->start),
305-
PHYS_PFN(resource_size(res)), &restrictions);
305+
PHYS_PFN(resource_size(res)), &params);
306306
} else {
307307
error = kasan_add_zero_shadow(__va(res->start), resource_size(res));
308308
if (error) {
@@ -311,15 +311,15 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
311311
}
312312

313313
error = arch_add_memory(nid, res->start, resource_size(res),
314-
&restrictions);
314+
&params);
315315
}
316316

317317
if (!error) {
318318
struct zone *zone;
319319

320320
zone = &NODE_DATA(nid)->node_zones[ZONE_DEVICE];
321321
move_pfn_range_to_zone(zone, PHYS_PFN(res->start),
322-
PHYS_PFN(resource_size(res)), restrictions.altmap);
322+
PHYS_PFN(resource_size(res)), params.altmap);
323323
}
324324

325325
mem_hotplug_done();

0 commit comments

Comments
 (0)