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: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 316be863
...@@ -88,7 +88,8 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment