Skip to content

Commit

Permalink
mem: fix memsegs exhausted message
Browse files Browse the repository at this point in the history
[ upstream commit d93000bb9310685d0df3aa2c11cff3000ed17a82 ]

When there is not enough space to memsegs, we should prompt
which configuration should be modified instead of printing
some numbers.

Fixes: dd61b34 ("mem: error if requesting more segments than MAX_MEMSEG")
Fixes: 66cc45e ("mem: replace memseg with memseg lists")

Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
  • Loading branch information
Fengnan Chang authored and kevintraynor committed Jul 12, 2023
1 parent 5634ca2 commit 00c14e2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
6 changes: 2 additions & 4 deletions lib/eal/common/eal_common_dynmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ eal_dynmem_memseg_lists_init(void)
max_seglists_per_type = RTE_MAX_MEMSEG_LISTS / n_memtypes;

if (max_seglists_per_type == 0) {
RTE_LOG(ERR, EAL, "Cannot accommodate all memory types, please increase %s\n",
RTE_STR(RTE_MAX_MEMSEG_LISTS));
RTE_LOG(ERR, EAL, "Cannot accommodate all memory types, please increase RTE_MAX_MEMSEG_LISTS\n");
goto out;
}

Expand Down Expand Up @@ -179,8 +178,7 @@ eal_dynmem_memseg_lists_init(void)
for (cur_seglist = 0; cur_seglist < n_seglists; cur_seglist++) {
if (msl_idx >= RTE_MAX_MEMSEG_LISTS) {
RTE_LOG(ERR, EAL,
"No more space in memseg lists, please increase %s\n",
RTE_STR(RTE_MAX_MEMSEG_LISTS));
"No more space in memseg lists, please increase RTE_MAX_MEMSEG_LISTS\n");
goto out;
}
msl = &mcfg->memsegs[msl_idx++];
Expand Down
8 changes: 3 additions & 5 deletions lib/eal/freebsd/eal_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@ rte_eal_hugepage_init(void)
break;
}
if (msl_idx == RTE_MAX_MEMSEG_LISTS) {
RTE_LOG(ERR, EAL, "Could not find space for memseg. Please increase %s and/or %s in configuration.\n",
RTE_STR(RTE_MAX_MEMSEG_PER_TYPE),
RTE_STR(RTE_MAX_MEM_MB_PER_TYPE));
RTE_LOG(ERR, EAL, "Could not find space for memseg. Please increase RTE_MAX_MEMSEG_PER_LIST "
"RTE_MAX_MEMSEG_PER_TYPE and/or RTE_MAX_MEM_MB_PER_TYPE in configuration.\n");
return -1;
}
arr = &msl->memseg_arr;
Expand Down Expand Up @@ -404,8 +403,7 @@ memseg_primary_init(void)

if (msl_idx >= RTE_MAX_MEMSEG_LISTS) {
RTE_LOG(ERR, EAL,
"No more space in memseg lists, please increase %s\n",
RTE_STR(RTE_MAX_MEMSEG_LISTS));
"No more space in memseg lists, please increase RTE_MAX_MEMSEG_LISTS\n");
return -1;
}

Expand Down
11 changes: 4 additions & 7 deletions lib/eal/linux/eal_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,9 +721,8 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
break;
}
if (msl_idx == RTE_MAX_MEMSEG_LISTS) {
RTE_LOG(ERR, EAL, "Could not find space for memseg. Please increase %s and/or %s in configuration.\n",
RTE_STR(RTE_MAX_MEMSEG_PER_TYPE),
RTE_STR(RTE_MAX_MEM_MB_PER_TYPE));
RTE_LOG(ERR, EAL, "Could not find space for memseg. Please increase RTE_MAX_MEMSEG_PER_LIST "
"RTE_MAX_MEMSEG_PER_TYPE and/or RTE_MAX_MEM_MB_PER_TYPE in configuration.\n");
return -1;
}

Expand Down Expand Up @@ -971,8 +970,7 @@ prealloc_segments(struct hugepage_file *hugepages, int n_pages)
break;
}
if (msl_idx == RTE_MAX_MEMSEG_LISTS) {
RTE_LOG(ERR, EAL, "Not enough space in memseg lists, please increase %s\n",
RTE_STR(RTE_MAX_MEMSEG_LISTS));
RTE_LOG(ERR, EAL, "Not enough space in memseg lists, please increase RTE_MAX_MEMSEG_LISTS\n");
return -1;
}

Expand Down Expand Up @@ -1838,8 +1836,7 @@ memseg_primary_init_32(void)

if (msl_idx >= RTE_MAX_MEMSEG_LISTS) {
RTE_LOG(ERR, EAL,
"No more space in memseg lists, please increase %s\n",
RTE_STR(RTE_MAX_MEMSEG_LISTS));
"No more space in memseg lists, please increase RTE_MAX_MEMSEG_LISTS\n");
return -1;
}

Expand Down

0 comments on commit 00c14e2

Please sign in to comment.