diff options
author | Yajun Deng <yajun.deng@linux.dev> | 2023-07-12 09:47:58 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2023-07-31 17:54:29 +0200 |
commit | bf29bfaa54901a4bdee2a18cd10eb951a884a5f9 (patch) | |
tree | 830ab38ee71ea12958a18cbaa6c145c729a6ab2f /mm/cma.c | |
parent | dma-contiguous: support per-numa CMA for all architectures (diff) | |
download | linux-bf29bfaa54901a4bdee2a18cd10eb951a884a5f9.tar.xz linux-bf29bfaa54901a4bdee2a18cd10eb951a884a5f9.zip |
dma-contiguous: support numa CMA for specified node
The kernel parameter 'cma_pernuma=' only supports reserving the same
size of CMA area for each node. We need to reserve different sizes of
CMA area for specified nodes if these devices belong to different nodes.
Adding another kernel parameter 'numa_cma=' to reserve CMA area for
the specified node. If we want to use one of these parameters, we need to
enable DMA_NUMA_CMA.
At the same time, print the node id in cma_declare_contiguous_nid() if
CONFIG_NUMA is enabled.
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'mm/cma.c')
-rw-r--r-- | mm/cma.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -267,6 +267,9 @@ int __init cma_declare_contiguous_nid(phys_addr_t base, if (alignment && !is_power_of_2(alignment)) return -EINVAL; + if (!IS_ENABLED(CONFIG_NUMA)) + nid = NUMA_NO_NODE; + /* Sanitise input arguments. */ alignment = max_t(phys_addr_t, alignment, CMA_MIN_ALIGNMENT_BYTES); if (fixed && base & (alignment - 1)) { @@ -372,14 +375,15 @@ int __init cma_declare_contiguous_nid(phys_addr_t base, if (ret) goto free_mem; - pr_info("Reserved %ld MiB at %pa\n", (unsigned long)size / SZ_1M, - &base); + pr_info("Reserved %ld MiB at %pa on node %d\n", (unsigned long)size / SZ_1M, + &base, nid); return 0; free_mem: memblock_phys_free(base, size); err: - pr_err("Failed to reserve %ld MiB\n", (unsigned long)size / SZ_1M); + pr_err("Failed to reserve %ld MiB on node %d\n", (unsigned long)size / SZ_1M, + nid); return ret; } |