mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 06:21:08 +00:00
parse: prefault config file with MAP_POPULATE
When we call lxc_file_for_each_line_mmap() we will always parse the whole config file. Prefault it in case it is really long to optimize performance. Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
907e133201
commit
2291ea4a1a
@ -88,7 +88,8 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = lxc_strmmap(NULL, st.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
buf = lxc_strmmap(NULL, st.st_size, PROT_READ | PROT_WRITE,
|
||||||
|
MAP_PRIVATE | MAP_POPULATE, fd, 0);
|
||||||
if (buf == MAP_FAILED) {
|
if (buf == MAP_FAILED) {
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user