[PATCH OLK-6.6 0/2] support mempool and NUMA.remote for 64KB page
Support mempool and NUMA.remote for 64KB page. Jinjiang Tu (2): mm/pfn_range_alloc: add support for CONFIG_ARM64_64K_PAGES mm/numa_remote: remove depends on ARM64_4K_PAGES arch/arm64/mm/Kconfig | 1 + arch/arm64/mm/pfn_range_alloc.c | 29 ++++++++++++++++++++++------- drivers/base/Kconfig | 2 +- 3 files changed, 24 insertions(+), 8 deletions(-) -- 2.43.0
hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/8392 ---------------------------------------- make pfn_range_alloc support for CONFIG_ARM64_64K_PAGES. 1) When CONFIG_ARM64_64K_PAGES is enabled, reject to parse cmdline pmd_mapping and ask to specify rodata=full if pfn_range_alloc feature is needed. pfn_range_alloc() will try to allocate from buddy directly with reclaim enabled. So pmd_mapping doesn't need. 2) For set_linear_mapping_{nc, invalid}, if rodata=full is specified, don't force the pfn range is PMD-aligned, because the attribute of linear mapping could be modified at PAGE granularity. 3) Besides, add ARM64_4K_PAGES or ARM64_64K_PAGES dependency for config PFN_RANGE_ALLOC since we support this feature only when base page is 4KB or 64KB. Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com> --- arch/arm64/mm/Kconfig | 1 + arch/arm64/mm/pfn_range_alloc.c | 29 ++++++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/arch/arm64/mm/Kconfig b/arch/arm64/mm/Kconfig index e7880c691822..315b3322feb5 100644 --- a/arch/arm64/mm/Kconfig +++ b/arch/arm64/mm/Kconfig @@ -8,6 +8,7 @@ config PFN_RANGE_ALLOC default n select CONTIG_ALLOC depends on MEMORY_HOTPLUG + depends on ARM64_4K_PAGES || ARM64_64K_PAGES help It allows to allocate contiguous memory from special pfn range, the linear mapping granule of this range is never larger than PMD. diff --git a/arch/arm64/mm/pfn_range_alloc.c b/arch/arm64/mm/pfn_range_alloc.c index 011b65bcbbaa..c3f5fb0164d4 100644 --- a/arch/arm64/mm/pfn_range_alloc.c +++ b/arch/arm64/mm/pfn_range_alloc.c @@ -44,6 +44,11 @@ static __init int cmdline_parse_pmd_mapping(char *p) unsigned long percent; char *endptr; + if (IS_ENABLED(CONFIG_ARM64_64K_PAGES)) { + pr_warn("page size is 64KB, don't use pmd_mapping, use rodata=full instead\n"); + return -EINVAL; + } + if (!p) return -EINVAL; @@ -248,21 +253,29 @@ struct folio *pfn_range_alloc(unsigned int nr_pages, int nid) if (nid < 0 || nid >= MAX_NUMNODES) goto out; +#ifdef CONFIG_ARM64_4K_PAGES if (!IS_ALIGNED(nr_pages, min_align)) goto out; +#endif + +#ifdef CONFIG_ARM64_64K_PAGES + if (!can_set_direct_map()) + goto out; +#endif if (can_set_direct_map() || should_pmd_linear_mapping()) { int order = ilog2(nr_pages); - folio = NULL; gfp_mask |= __GFP_THISNODE; - if (nr_pages <= MAX_ORDER_NR_PAGES) - folio = __folio_alloc_node(gfp_mask | __GFP_NOWARN, order, nid); - if (!folio) + if (nr_pages <= MAX_ORDER_NR_PAGES) { + gfp_mask |= __GFP_RECLAIM | __GFP_NOWARN | __GFP_NORETRY; + folio = __folio_alloc_node(gfp_mask, order, nid); + } else { folio = folio_alloc_gigantic(order, gfp_mask, nid, NULL); + } + if (!folio) folio = ERR_PTR(-ENOMEM); - goto out; } @@ -400,14 +413,16 @@ static inline int check_update_lm_arg(unsigned long start_pfn, unsigned long end struct page *start_page; int nid; + if (can_set_direct_map()) + return 0; + start_page = pfn_to_page(start_pfn); nid = page_to_nid(start_page); start = (unsigned long)page_to_virt(start_page); end = start + (end_pfn - start_pfn) * PAGE_SIZE; if ((start_pfn >= reserved_range[nid].start_pfn && end_pfn <= reserved_range[nid].end_pfn) - || should_pmd_linear_mapping() - || can_set_direct_map()) { + || should_pmd_linear_mapping()) { if (!IS_ALIGNED(start, PFN_RANGE_ALLOC_SIZE) || !IS_ALIGNED(end, PFN_RANGE_ALLOC_SIZE)) { return -EINVAL; -- 2.43.0
hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/8392 ---------------------------------------- Remove CONFIG_ARM64_4K_PAGES dependency for CONFIG_NUMA_REMOTE, to support NUMA.remote feature when page size is 64KB. Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com> --- drivers/base/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 584ee676aa88..8715ff03ae60 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -178,7 +178,7 @@ config HMEM_REPORTING config NUMA_REMOTE bool "Establish numa node for remote memory" depends on NUMA - depends on ARM64 && ARM64_4K_PAGES + depends on ARM64 depends on SPARSEMEM_VMEMMAP depends on ZONE_EXTMEM help -- 2.43.0
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://atomgit.com/openeuler/kernel/merge_requests/20294 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/PTN... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://atomgit.com/openeuler/kernel/merge_requests/20294 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/PTN...
participants (2)
-
Jinjiang Tu -
patchwork bot