mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-17 20:54:10 +00:00
mm: cma: use CMA_MAX_NAME to define the length of cma name array
CMA_MAX_NAME should be visible to CMA's users as they might need it to set the name of CMA areas and avoid hardcoding the size locally. So this patch moves CMA_MAX_NAME from local header file to include/linux header file and removes the hardcode in both hugetlb.c and contiguous.c. Signed-off-by: Barry Song <song.bao.hua@hisilicon.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
c6303ab9b9
commit
2281f797f5
4 changed files with 5 additions and 5 deletions
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define CMA_MAX_NAME 64
|
||||||
|
|
||||||
struct cma;
|
struct cma;
|
||||||
|
|
||||||
extern unsigned long totalcma_pages;
|
extern unsigned long totalcma_pages;
|
||||||
|
|
|
@ -119,7 +119,7 @@ void __init dma_pernuma_cma_reserve(void)
|
||||||
|
|
||||||
for_each_online_node(nid) {
|
for_each_online_node(nid) {
|
||||||
int ret;
|
int ret;
|
||||||
char name[20];
|
char name[CMA_MAX_NAME];
|
||||||
struct cma **cma = &dma_contiguous_pernuma_area[nid];
|
struct cma **cma = &dma_contiguous_pernuma_area[nid];
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "pernuma%d", nid);
|
snprintf(name, sizeof(name), "pernuma%d", nid);
|
||||||
|
|
2
mm/cma.h
2
mm/cma.h
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
|
|
||||||
#define CMA_MAX_NAME 64
|
|
||||||
|
|
||||||
struct cma {
|
struct cma {
|
||||||
unsigned long base_pfn;
|
unsigned long base_pfn;
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
|
|
|
@ -5683,12 +5683,12 @@ void __init hugetlb_cma_reserve(int order)
|
||||||
reserved = 0;
|
reserved = 0;
|
||||||
for_each_node_state(nid, N_ONLINE) {
|
for_each_node_state(nid, N_ONLINE) {
|
||||||
int res;
|
int res;
|
||||||
char name[20];
|
char name[CMA_MAX_NAME];
|
||||||
|
|
||||||
size = min(per_node, hugetlb_cma_size - reserved);
|
size = min(per_node, hugetlb_cma_size - reserved);
|
||||||
size = round_up(size, PAGE_SIZE << order);
|
size = round_up(size, PAGE_SIZE << order);
|
||||||
|
|
||||||
snprintf(name, 20, "hugetlb%d", nid);
|
snprintf(name, sizeof(name), "hugetlb%d", nid);
|
||||||
res = cma_declare_contiguous_nid(0, size, 0, PAGE_SIZE << order,
|
res = cma_declare_contiguous_nid(0, size, 0, PAGE_SIZE << order,
|
||||||
0, false, name,
|
0, false, name,
|
||||||
&hugetlb_cma[nid], nid);
|
&hugetlb_cma[nid], nid);
|
||||||
|
|
Loading…
Add table
Reference in a new issue