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

Function handle_free_request

dpdk/lib/eal/common/malloc_mp.c:178–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178static int
179handle_free_request(const struct malloc_mp_req *m)
180{
181 const struct rte_memseg_list *msl;
182 void *start, *end;
183 size_t len;
184
185 len = m->free_req.len;
186 start = m->free_req.addr;
187 end = RTE_PTR_ADD(start, len - 1);
188
189 /* check if the requested memory actually exists */
190 msl = rte_mem_virt2memseg_list(start);
191 if (msl == NULL) {
192 RTE_LOG(ERR, EAL, "Requested to free unknown memory\n");
193 return -1;
194 }
195
196 /* check if end is within the same memory region */
197 if (rte_mem_virt2memseg_list(end) != msl) {
198 RTE_LOG(ERR, EAL, "Requested to free memory spanning multiple regions\n");
199 return -1;
200 }
201
202 /* we're supposed to only free memory that's not external */
203 if (msl->external) {
204 RTE_LOG(ERR, EAL, "Requested to free external memory\n");
205 return -1;
206 }
207
208 /* now that we've validated the request, announce it */
209 eal_memalloc_mem_event_notify(RTE_MEM_EVENT_FREE,
210 m->free_req.addr, m->free_req.len);
211
212 /* now, do the actual freeing */
213 return malloc_heap_free_pages(m->free_req.addr, m->free_req.len);
214}
215
216static int
217handle_alloc_request(const struct malloc_mp_req *m,

Callers 1

handle_requestFunction · 0.85

Calls 3

rte_mem_virt2memseg_listFunction · 0.85
malloc_heap_free_pagesFunction · 0.85

Tested by

no test coverage detected