Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround mmap restrictions due to CONFIG_STRICT_DEVMEM #29

Open
rbossy opened this issue Jan 13, 2022 · 0 comments
Open

Workaround mmap restrictions due to CONFIG_STRICT_DEVMEM #29

rbossy opened this issue Jan 13, 2022 · 0 comments

Comments

@rbossy
Copy link
Member

rbossy commented Jan 13, 2022

In systems where the kernel is compiled with option CONFIG_STRICT_DEVMEM, mmap is limited to 1MB: https://stackoverflow.com/questions/8213671/mmap-operation-not-permitted.

The marshalling framework uses mmap with the maximum available size, raising IOException:

public ByteBuffer getBuffer(long position) {
try {
long absPosition = startPosition + position;
long size = Math.min(channel.size() - absPosition, Integer.MAX_VALUE);
return channel.map(MapMode.READ_ONLY, absPosition, size);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}

Solution 1: tell users to recompile kernel. Not always possible.

Solution 2: mmap 1MB only. Problem is that the unmarshalled object might be larger than 1MB.

Solution 3: create a ByteBuffer based on 1MB mmap, but closes and reopens the mmap as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant