MCPcopy Create free account
hub / github.com/F-Stack/f-stack / eal_memalloc_free_seg_bulk

Function eal_memalloc_free_seg_bulk

dpdk/lib/eal/linux/eal_memalloc.c:1088–1140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1086}
1087
1088int
1089eal_memalloc_free_seg_bulk(struct rte_memseg **ms, int n_segs)
1090{
1091 int seg, ret = 0;
1092 struct internal_config *internal_conf =
1093 eal_get_internal_configuration();
1094
1095 /* dynamic free not supported in legacy mode */
1096 if (internal_conf->legacy_mem)
1097 return -1;
1098
1099 for (seg = 0; seg < n_segs; seg++) {
1100 struct rte_memseg *cur = ms[seg];
1101 struct hugepage_info *hi = NULL;
1102 struct free_walk_param wa;
1103 int i, walk_res;
1104
1105 /* if this page is marked as unfreeable, fail */
1106 if (cur->flags & RTE_MEMSEG_FLAG_DO_NOT_FREE) {
1107 RTE_LOG(DEBUG, EAL, "Page is not allowed to be freed\n");
1108 ret = -1;
1109 continue;
1110 }
1111
1112 memset(&wa, 0, sizeof(wa));
1113
1114 for (i = 0; i < (int)RTE_DIM(internal_conf->hugepage_info);
1115 i++) {
1116 hi = &internal_conf->hugepage_info[i];
1117 if (cur->hugepage_sz == hi->hugepage_sz)
1118 break;
1119 }
1120 if (i == (int)RTE_DIM(internal_conf->hugepage_info)) {
1121 RTE_LOG(ERR, EAL, "Can't find relevant hugepage_info entry\n");
1122 ret = -1;
1123 continue;
1124 }
1125
1126 wa.ms = cur;
1127 wa.hi = hi;
1128
1129 /* memalloc is locked, so it's safe to use thread-unsafe version
1130 */
1131 walk_res = rte_memseg_list_walk_thread_unsafe(free_seg_walk,
1132 &wa);
1133 if (walk_res == 1)
1134 continue;
1135 if (walk_res == 0)
1136 RTE_LOG(ERR, EAL, "Couldn't find memseg list\n");
1137 ret = -1;
1138 }
1139 return ret;
1140}
1141
1142int
1143eal_memalloc_free_seg(struct rte_memseg *ms)

Callers 2

eal_memalloc_free_segFunction · 0.70
rollback_expand_heapFunction · 0.50

Calls 3

memsetFunction · 0.85

Tested by

no test coverage detected