OpenHFT / Posix

Other
3 stars 5 forks source link

Support mlock2 on older kernels via syscall #4

Closed rogersimmons closed 2 years ago

rogersimmons commented 2 years ago

mlock2 is not available in Linux 3.x - how is it going to work? I thought we have to maybe go through regular mlock?

Will it just fail recoverably?

mlock2 functionality exists in kernels before 4.4 - and in particular 3.x which dev# are using. The feature hasn't been wrapped in glibc which is why it hasn't been exposed. syscall can be used to access instead

alamar commented 2 years ago

OK if you say so, but we still need to pick a correct syscall number per architecture, or ensure we only allow mlock2 on AMD64.

alamar commented 2 years ago

The number 284 seems to be coming from uapi/asm-generic - I'm not sure what it stands for given my limited experience with kernel.

However, I have checked out Linux v3.10 on which our agents are based, there are no mentions on mlock2, so it seems we can't run tests against this functionality on our agents.

rogersimmons commented 2 years ago

As mentioned earlier the dev11/12/13 hosts have mlock2, it's just not exposed via glibc:

$> man mlock2
       Note: currently, there is not a glibc wrapper for mlock2(), so it will need to be invoked using syscall(2).