[Fontconfig] [PATCH 1/2] Use MAP_POPULATE to eliminate startup page faults.
Keith Packard
keithp at keithp.com
Thu Dec 31 12:49:18 PST 2009
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
More information about the Fontconfig
mailing list