History

mm: make deferred init's max threads arch-specific

Using padata during deferred init has only been tested on x86, so for now limit it to this architecture. If another arch wants this, it can find the max thread limit that's best for it and override deferred_page_init_max_threads().

Daniel Jordan committed 6 years ago

Commit ecd09651 parent e4443143 files · +23 −5Browse files

Unified · Split

3 files
  1. arch/x86/mm/init_64.c +12 −0
  2. include/linux/memblock.h +3 −0
  3. mm/page_alloc.c +8 −5
arch/x86/mm/init_64.c+12−0
@@ -1265,6 +1265,18 @@ void __init mem_init(void) · 1264 unmodified lines
1265 mem_init_print_info(NULL);1265 mem_init_print_info(NULL);
1266}1266}
1267 1267
1268#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
1269int __init deferred_page_init_max_threads(const struct cpumask *node_cpumask)
1270{
1271 /*
1272 * More CPUs always led to greater speedups on tested systems, up to
1273 * all the nodes' CPUs. Use all since the system is otherwise idle
1274 * now.
1275 */
1276 return max_t(int, cpumask_weight(node_cpumask), 1);
1277}
1278#endif
1279
1268int kernel_set_to_readonly;1280int kernel_set_to_readonly;
1269 1281
1270void mark_rodata_ro(void)1282void mark_rodata_ro(void)
include/linux/memblock.h+3−0
@@ -273,6 +273,9 @@ void __next_mem_pfn_range_in_zone(u64 *idx, struct zone *zone, · 272 unmodified lines
273#define for_each_free_mem_pfn_range_in_zone_from(i, zone, p_start, p_end) \273#define for_each_free_mem_pfn_range_in_zone_from(i, zone, p_start, p_end) \
274 for (; i != U64_MAX; \274 for (; i != U64_MAX; \
275 __next_mem_pfn_range_in_zone(&i, zone, p_start, p_end))275 __next_mem_pfn_range_in_zone(&i, zone, p_start, p_end))
276
277int __init deferred_page_init_max_threads(const struct cpumask *node_cpumask);
278
276#endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */279#endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */
277 280
278/**281/**
mm/page_alloc.c+8−5
@@ -1836,6 +1836,13 @@ deferred_init_memmap_chunk(unsigned long start_pfn, unsigned long end_pfn, · 1835 unmodified lines
1836 }1836 }
1837}1837}
1838 1838
1839/* An arch may override for more concurrency. */
1840__weak int __init
1841deferred_page_init_max_threads(const struct cpumask *node_cpumask)
1842{
1843 return 1;
1844}
1845
1839/* Initialise remaining memory on a node */1846/* Initialise remaining memory on a node */
1840static int __init deferred_init_memmap(void *data)1847static int __init deferred_init_memmap(void *data)
1841{1848{
@@ -1884,11 +1891,7 @@ static int __init deferred_init_memmap(void *data) · 42 unmodified lines
1884 first_init_pfn))1891 first_init_pfn))
1885 goto zone_empty;1892 goto zone_empty;
1886 1893
1887 /*1894 max_threads = deferred_page_init_max_threads(cpumask);
1888 * More CPUs always led to greater speedups on tested systems, up to
1889 * all the nodes' CPUs. Use all since the system is otherwise idle now.
1890 */
1891 max_threads = max(cpumask_weight(cpumask), 1u);
1892 1895
1893 while (spfn < epfn) {1896 while (spfn < epfn) {
1894 unsigned long epfn_align = ALIGN(epfn, PAGES_PER_SECTION);1897 unsigned long epfn_align = ALIGN(epfn, PAGES_PER_SECTION);