]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/spdk/dpdk/lib/librte_eal/common/malloc_elem.c
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / dpdk / lib / librte_eal / common / malloc_elem.c
index 658c9b5b7993c33473d414cb36b1996f2cb6ba98..51cdfc5d599b62732e19a38aca0fe16c367f9baf 100644 (file)
@@ -171,7 +171,7 @@ malloc_elem_insert(struct malloc_elem *elem)
                next_elem = NULL;
                heap->last = elem;
        } else {
-               /* the new memory is somewhere inbetween start and end */
+               /* the new memory is somewhere between start and end */
                uint64_t dist_from_start, dist_from_end;
 
                dist_from_end = RTE_PTR_DIFF(heap->last, elem);
@@ -307,6 +307,11 @@ split_elem(struct malloc_elem *elem, struct malloc_elem *split_pt)
        elem->next = split_pt;
        elem->size = old_elem_size;
        set_trailer(elem);
+       if (elem->pad) {
+               /* Update inner padding inner element size. */
+               elem = RTE_PTR_ADD(elem, elem->pad);
+               elem->size = old_elem_size - elem->pad;
+       }
 }
 
 /*
@@ -482,6 +487,10 @@ join_elem(struct malloc_elem *elem1, struct malloc_elem *elem2)
        else
                elem1->heap->last = elem1;
        elem1->next = next;
+       if (elem1->pad) {
+               struct malloc_elem *inner = RTE_PTR_ADD(elem1, elem1->pad);
+               inner->size = elem1->size - elem1->pad;
+       }
 }
 
 struct malloc_elem *