nandu
nandu

Reputation: 2653

x86 linux - how to create custom malloc with address hint

I want to create a custom malloc which allocates memory blocks within a given address range.

I am writing a pthreads application in which threads are bound to unique cores on a many-core machine. The memory controllers are statically mapped, so that certain range of addresses on main memory are electrically closer to a core. I want to minimize the latency of communication between cores and main memory by allocating thread memory on these "closer" regions.

Any ideas would be most appreciated. Thank you! Nandu

Upvotes: 3

Views: 665

Answers (1)

Axel Gneiting
Axel Gneiting

Reputation: 5423

There is already libnuma for that purpose. Take a look at numa_alloc_onnode

Upvotes: 1

Related Questions