The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2667

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
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.brau...@ubuntu.com>
From 2291ea4a1a40f67d76a108e96cee83cb65038f9a Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@ubuntu.com>
Date: Tue, 2 Oct 2018 16:40:13 +0200
Subject: [PATCH] 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.brau...@ubuntu.com>
---
 src/lxc/parse.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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;
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to