Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/jemalloc/dist/src we have MAP_ALIGNED, so use i...



details:   https://anonhg.NetBSD.org/src/rev/a459e9705070
branches:  trunk
changeset: 997623:a459e9705070
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Mar 16 22:14:08 2019 +0000

description:
we have MAP_ALIGNED, so use it (although it does not do anything by default)

diffstat:

 external/bsd/jemalloc/dist/src/pages.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r bf47a3b8d16e -r a459e9705070 external/bsd/jemalloc/dist/src/pages.c
--- a/external/bsd/jemalloc/dist/src/pages.c    Sat Mar 16 21:57:15 2019 +0000
+++ b/external/bsd/jemalloc/dist/src/pages.c    Sat Mar 16 22:14:08 2019 +0000
@@ -14,6 +14,9 @@
 #include <vm/vm_param.h>
 #endif
 #endif
+#ifdef MAP_ALIGNED
+#include <sys/bitops.h>        /* NetBSD */
+#endif
 
 /******************************************************************************/
 /* Data. */
@@ -74,9 +77,15 @@
         * of existing mappings, and we only want to create new mappings.
         */
        {
+               int flags = mmap_flags;
+#ifdef MAP_ALIGNED
+               int a = ilog2(alignment);
+               if (a > LG_PAGE && a < ilog2(sizeof(void *)))
+                       flags |= MAP_ALIGNED(a);
+#endif
                int prot = *commit ? PAGES_PROT_COMMIT : PAGES_PROT_DECOMMIT;
 
-               ret = mmap(addr, size, prot, mmap_flags, -1, 0);
+               ret = mmap(addr, size, prot, flags, -1, 0);
        }
        assert(ret != NULL);
 



Home | Main Index | Thread Index | Old Index