From: Christian Brauner Date: Tue, 2 Oct 2018 14:40:13 +0000 (+0200) Subject: parse: prefault config file with MAP_POPULATE X-Git-Tag: lxc-3.1.0~70^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2667%2Fhead;p=thirdparty%2Flxc.git 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 --- diff --git a/src/lxc/parse.c b/src/lxc/parse.c index fcc174a77..1c0cc9f49 100644 --- a/src/lxc/parse.c +++ b/src/lxc/parse.c @@ -88,7 +88,8 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, 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) { close(fd); return -1;