flexnbd: Add more madvise() hints, both for mirroring out and normal operation.
This is hopefully going to reduce flexnbd rss
This commit is contained in:
@@ -551,6 +551,12 @@ void* client_serve(void* client_uncast)
|
||||
),
|
||||
"Couldn't open/mmap file %s: %s", client->serve->filename, strerror( errno )
|
||||
);
|
||||
|
||||
FATAL_IF_NEGATIVE(
|
||||
madvise( client->mapped, client->serve->size, MADV_SEQUENTIAL ),
|
||||
SHOW_ERRNO( "Failed to madvise() %s", client->serve->filename )
|
||||
);
|
||||
|
||||
debug( "Opened client file fd %d", client->fileno);
|
||||
debug("client: sending hello");
|
||||
client_send_hello(client);
|
||||
|
@@ -89,6 +89,11 @@ void mirror_init( struct mirror * mirror, const char * filename )
|
||||
filename
|
||||
);
|
||||
|
||||
FATAL_IF_NEGATIVE(
|
||||
madvise( mirror->mapped, size, MADV_SEQUENTIAL ),
|
||||
SHOW_ERRNO( "Failed to madvise() %s", filename )
|
||||
);
|
||||
|
||||
mirror->dirty_map = bitset_alloc(size, 4096);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user