[PATCH 1/2] Use MAP_POPULATE to eliminate startup page faults.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



MAP_POPULATE fills in the PTEs with the pages for the font cache files
eliminating the per-page faults which would otherwise be necessary as the
cache is scanned to match the first font.
---
 src/fccache.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/fccache.c b/src/fccache.c
index 69e1a6b..a59e0a3 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -552,6 +552,10 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
     if (fd_stat->st_size >= FC_CACHE_MIN_MMAP)
     {
 #if defined(HAVE_MMAP) || defined(__CYGWIN__)
+#ifndef MAP_POPULATE
+#define MAP_POPULATE 0
+#endif
+	cache = mmap (0, fd_stat->st_size, PROT_READ, MAP_SHARED | MAP_POPULATE, fd, 0);
 	cache = mmap (0, fd_stat->st_size, PROT_READ, MAP_SHARED, fd, 0);
 	if (cache == MAP_FAILED)
 	    cache = NULL;
-- 
1.6.5.7

_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux