Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
memory: fix trimming of allocated spans
Trimmers may request buffers smaller than n_pages, the original value passed to allocate_large_and_trim(). That's why t.nr_page should be used as a final size of the allocated span. Another issue with the handling of span trimming is the order of operations when pages from the beginning of the buffer are trimmed. In such case span is updated to point to the actual beginning of the requested buffer, but afterwards it is used to retrieve span->span_size value which is expected to be the size of the originally allocated page span. Because the span pointer was changed the value is invalid and the trimming doesn't free all trimmed pages. Signed-off-by: Paweł Dziepak <[email protected]>
- Loading branch information