[vlc-devel] commit: mmap: Use fnctl to set the READAHEAD flag when supported. This should speedup the mmap performance (Derk-Jan Hartman )

git version control git at videolan.org
Fri Sep 19 23:36:38 CEST 2008


vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Fri Sep 19 23:38:29 2008 +0200| [7ac6c94720ed2d32dde51299824475b27ff1edc1] | committer: Derk-Jan Hartman 

mmap: Use fnctl to set the READAHEAD flag when supported. This should speedup the mmap performance

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7ac6c94720ed2d32dde51299824475b27ff1edc1
---

 modules/access/mmap.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/modules/access/mmap.c b/modules/access/mmap.c
index 220d5e7..e49c041 100644
--- a/modules/access/mmap.c
+++ b/modules/access/mmap.c
@@ -119,6 +119,13 @@ static int Open (vlc_object_t *p_this)
         goto error;
     }
 
+# if defined(HAVE_FCNTL_H) && defined(F_FDAHEAD) && defined(F_NOCACHE)
+    /* We'd rather use any available memory for reading ahead
+     * than for caching what we've already mmap'ed */
+    fcntl (fd, F_RDAHEAD, 1);
+    fcntl (fd, F_NOCACHE, 1);
+# endif
+
     /* Autodetect mmap() support */
     if (st.st_size > 0)
     {




More information about the vlc-devel mailing list