GitLab maintenance scheduled for Today, 2019-12-05, from 17:00 to 18:00 CT - Services will be unavailable during this time.

Commit 30d3840a authored by Swann Perarnau's avatar Swann Perarnau

[fix] Align mbind arguments properly.

mbind requires that the input ptr be aligned on a page.

NOTE: we could also figure out a way to ask jemalloc
for page-aligned allocations, but that would probably
be too much for each alloc.
parent 67114902
Pipeline #6962 passed with stage
in 3 minutes and 46 seconds
......@@ -41,7 +41,10 @@ int aml_area_linux_mbind_regular_post_bind(struct aml_area_linux_mbind_data *dat
void *ptr, size_t sz)
{
assert(data != NULL);
return mbind(ptr, sz, data->policy, data->nodemask, AML_MAX_NUMA_NODES, 0);
/* realign ptr to match mbind requirement that it is aligned on a page */
intptr_t aligned = (intptr_t)ptr & (intptr_t)(~(PAGE_SIZE -1));
size_t end = sz + ((intptr_t)ptr - aligned);
return mbind((void*)aligned, sz, data->policy, data->nodemask, AML_MAX_NUMA_NODES, 0);
}
struct aml_area_linux_mbind_ops aml_area_linux_mbind_regular_ops = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment