Changes to support mmap reads on Broker#57
Conversation
bef45cc to
a776a0a
Compare
src/utils/read_all.c
Outdated
| void * allocate_aligned(size_t size) { | ||
| size_t alignment = getpagesize(); | ||
| int malloc_offset = (size + alignment) % alignment; | ||
| void* mem = malloc(size + alignment); | ||
| return (char*) mem + malloc_offset; | ||
| } |
There was a problem hiding this comment.
I do not think that this will guarantee that the address is a multiple of alignment, while the size of the usable block is. In addition, i am wondering if it would be safe to use such an address with munmap().
We can instead rely on posix_memalign()
JaeseungYeom
left a comment
There was a problem hiding this comment.
I left some comments but I know you will be on vacation. So, I can make changes if you agree with my comments.
| } | ||
|
|
||
| ssize_t read_all (int fd, void **bufp) | ||
| ssize_t read_all (const char* filename, void **bufp) |
There was a problem hiding this comment.
This interface probably should take a page aligned memory address as an input for the UCX managed memory. So, the allocation would happen outside of this function.
There was a problem hiding this comment.
That is the buffer bufp. Once we do the UCX, we can move allocation there.
cc2f91e to
3e9a46c
Compare
|
@JaeseungYeom do u want me to work on this? |
|
Need to check the following before continuing:
|
Changes to support mmaped reads on broker.