malloc: fix adjacency check to also include segment list
It may so happen that two memory locations may be adjacent in
virtual memory, but belong to different segment lists. With
current code, such segments will be concatenated. Fix the
adjacency checking code to also check if the adjacent malloc
elements belong to the same memseg list.
Fixes: 66cc45e293
("mem: replace memseg with memseg lists")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
This commit is contained in:
parent
32fc0fa00e
commit
71aae4b421
@ -316,13 +316,15 @@ remove_elem(struct malloc_elem *elem)
|
||||
static int
|
||||
next_elem_is_adjacent(struct malloc_elem *elem)
|
||||
{
|
||||
return elem->next == RTE_PTR_ADD(elem, elem->size);
|
||||
return elem->next == RTE_PTR_ADD(elem, elem->size) &&
|
||||
elem->next->msl == elem->msl;
|
||||
}
|
||||
|
||||
static int
|
||||
prev_elem_is_adjacent(struct malloc_elem *elem)
|
||||
{
|
||||
return elem == RTE_PTR_ADD(elem->prev, elem->prev->size);
|
||||
return elem == RTE_PTR_ADD(elem->prev, elem->prev->size) &&
|
||||
elem->prev->msl == elem->msl;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user