Remove unused patches.

This commit is contained in:
Joe Orton 2018-01-19 12:36:44 +00:00
parent 864b542ad4
commit 4e886409fe
17 changed files with 0 additions and 1087 deletions

View File

@ -1,12 +0,0 @@
diff -up jemalloc-2.0.1/include/jemalloc/internal/jemalloc_internal.h.in.orig jemalloc-2.0.1/include/jemalloc/internal/jemalloc_internal.h.in
--- jemalloc-2.0.1/include/jemalloc/internal/jemalloc_internal.h.in.orig 2010-12-11 14:23:59.000000000 +0100
+++ jemalloc-2.0.1/include/jemalloc/internal/jemalloc_internal.h.in 2010-12-11 14:24:04.000000000 +0100
@@ -135,7 +135,7 @@ extern void (*JEMALLOC_P(malloc_message)
#ifdef __powerpc__
# define LG_QUANTUM 4
#endif
-#ifdef __s390x__
+#ifdef __s390__
# define LG_QUANTUM 4
#endif

View File

@ -1,24 +0,0 @@
--- Makefile.in.orig 2010-12-04 02:05:01.000000000 +0100
+++ Makefile.in 2011-01-05 23:13:32.000000000 +0100
@@ -42,7 +42,6 @@
endif
# Lists of files.
-BINS := @srcroot@bin/pprof
CHDRS := @objroot@include/jemalloc/jemalloc@install_suffix@.h \
@objroot@include/jemalloc/jemalloc_defs@install_suffix@.h
CSRCS := @srcroot@src/jemalloc.c @srcroot@src/arena.c @srcroot@src/base.c \
@@ -123,13 +122,6 @@
$(CC) -o $@ $< -L@objroot@lib -ljemalloc@install_suffix@
endif
-install_bin:
- install -d $(BINDIR)
- @for b in $(BINS); do \
- echo "install -m 755 $$b $(BINDIR)"; \
- install -m 755 $$b $(BINDIR); \
-done
-
install_include:
install -d $(INCLUDEDIR)/jemalloc
@for h in $(CHDRS); do \

View File

@ -1,25 +0,0 @@
diff -Naur ../jemalloc-2.2.0.orig/Makefile.in ./Makefile.in
--- ../jemalloc-2.2.0.orig/Makefile.in 2011-03-23 01:03:58.000000000 +0100
+++ ./Makefile.in 2011-03-28 23:56:21.000000000 +0200
@@ -42,7 +42,6 @@
endif
# Lists of files.
-BINS := @srcroot@bin/pprof
CHDRS := @objroot@include/jemalloc/jemalloc@install_suffix@.h \
@objroot@include/jemalloc/jemalloc_defs@install_suffix@.h
CSRCS := @srcroot@src/jemalloc.c @srcroot@src/arena.c @srcroot@src/atomic.c \
@@ -141,13 +140,6 @@
$(CC) -o $@ $< -L@objroot@lib -ljemalloc@install_suffix@
endif
-install_bin:
- install -d $(BINDIR)
- @for b in $(BINS); do \
- echo "install -m 755 $$b $(BINDIR)"; \
- install -m 755 $$b $(BINDIR); \
-done
-
install_include:
install -d $(INCLUDEDIR)/jemalloc
@for h in $(CHDRS); do \

View File

@ -1,24 +0,0 @@
--- Makefile.in.orig 2011-08-01 22:03:28.000000000 +0200
+++ Makefile.in 2011-08-01 22:02:33.000000000 +0200
@@ -42,7 +42,6 @@
endif
# Lists of files.
-BINS := @srcroot@bin/pprof
CHDRS := @objroot@include/jemalloc/jemalloc@install_suffix@.h \
@objroot@include/jemalloc/jemalloc_defs@install_suffix@.h
CSRCS := @srcroot@src/jemalloc.c @srcroot@src/arena.c @srcroot@src/atomic.c \
@@ -141,13 +140,6 @@
$(CC) -o $@ $< -L@objroot@lib -ljemalloc@install_suffix@ -lpthread
endif
-install_bin:
- install -d $(BINDIR)
- @for b in $(BINS); do \
- echo "install -m 755 $$b $(BINDIR)"; \
- install -m 755 $$b $(BINDIR); \
-done
-
install_include:
install -d $(INCLUDEDIR)/jemalloc
@for h in $(CHDRS); do \

View File

@ -1,11 +0,0 @@
--- include/jemalloc/internal/jemalloc_internal.h.in.orig 2012-05-14 08:29:24.332065965 +0200
+++ include/jemalloc/internal/jemalloc_internal.h.in 2012-05-14 08:29:39.483118492 +0200
@@ -276,7 +276,7 @@
# ifdef __powerpc__
# define LG_QUANTUM 4
# endif
-# ifdef __s390x__
+# ifdef __s390__
# define LG_QUANTUM 4
# endif
# ifdef __SH4__

View File

@ -1,256 +0,0 @@
diff -Naur ../jemalloc-3.0.0.orig/COPYING.epel5-ppc ./COPYING.epel5-ppc
--- ../jemalloc-3.0.0.orig/COPYING.epel5-ppc 1970-01-01 01:00:00.000000000 +0100
+++ ./COPYING.epel5-ppc 2012-05-18 16:21:31.869392165 +0200
@@ -0,0 +1,215 @@
+When using this jemalloc package with EPEL5 on ppc, please note that a
+non-upstream patch has been added. This patch is covered by the Apache
+2.0 License, which states that this work is
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+
+For other platforms and operating systems, please ignore this file.
+
+The patch adds missing 32bit atomic operations that is missing from
+RHEL5 and its derivates on ppc/ppc64. The code was fetched from the
+Apache Portable Runtime project, http://apr.apache.org/
+
+
+
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the
+copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other
+entities that control, are controlled by, or are under common control
+with that entity. For the purposes of this definition, "control" means
+(i) the power, direct or indirect, to cause the direction or
+management of such entity, whether by contract or otherwise, or (ii)
+ownership of fifty percent (50%) or more of the outstanding shares, or
+(iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation
+source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but not
+limited to compiled object code, generated documentation, and
+conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object
+form, made available under the License, as indicated by a copyright
+notice that is included in or attached to the work (an example is
+provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object
+form, that is based on (or derived from) the Work and for which the
+editorial revisions, annotations, elaborations, or other modifications
+represent, as a whole, an original work of authorship. For the
+purposes of this License, Derivative Works shall not include works
+that remain separable from, or merely link (or bind by name) to the
+interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the
+original version of the Work and any modifications or additions to
+that Work or Derivative Works thereof, that is intentionally submitted
+to Licensor for inclusion in the Work by the copyright owner or by an
+individual or Legal Entity authorized to submit on behalf of the
+copyright owner. For the purposes of this definition, "submitted"
+means any form of electronic, verbal, or written communication sent to
+the Licensor or its representatives, including but not limited to
+communication on electronic mailing lists, source code control
+systems, and issue tracking systems that are managed by, or on behalf
+of, the Licensor for the purpose of discussing and improving the Work,
+but excluding communication that is conspicuously marked or otherwise
+designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of, publicly
+display, publicly perform, sublicense, and distribute the Work and
+such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except
+as stated in this section) patent license to make, have made, use,
+offer to sell, sell, import, and otherwise transfer the Work, where
+such license applies only to those patent claims licensable by such
+Contributor that are necessarily infringed by their Contribution(s)
+alone or by combination of their Contribution(s) with the Work to
+which such Contribution(s) was submitted. If You institute patent
+litigation against any entity (including a cross-claim or counterclaim
+in a lawsuit) alleging that the Work or a Contribution incorporated
+within the Work constitutes direct or contributory patent
+infringement, then any patent licenses granted to You under this
+License for that Work shall terminate as of the date such litigation
+is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work
+or Derivative Works thereof in any medium, with or without
+modifications, and in Source or Object form, provided that You meet
+the following conditions:
+
+ You must give any other recipients of the Work or Derivative Works
+ a copy of this License; and
+
+ You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ You must retain, in the Source form of any Derivative Works that
+ You distribute, all copyright, patent, trademark, and attribution
+ notices from the Source form of the Work, excluding those notices
+ that do not pertain to any part of the Derivative Works; and
+
+ If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one of
+ the following places: within a NOTICE text file distributed as
+ part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents of
+ the NOTICE file are for informational purposes only and do not
+ modify the License. You may add Your own attribution notices
+ within Derivative Works that You distribute, alongside or as an
+ addendum to the NOTICE text from the Work, provided that such
+ additional attribution notices cannot be construed as modifying
+ the License. You may add Your own copyright statement to Your
+ modifications and may provide additional or different license
+ terms and conditions for use, reproduction, or distribution of
+ Your modifications, or for any such Derivative Works as a whole,
+ provided Your use, reproduction, and distribution of the Work
+ otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work by
+You to the Licensor shall be under the terms and conditions of this
+License, without any additional terms or conditions. Notwithstanding
+the above, nothing herein shall supersede or modify the terms of any
+separate license agreement you may have executed with Licensor
+regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed
+to in writing, Licensor provides the Work (and each Contributor
+provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, either express or implied, including, without
+limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely
+responsible for determining the appropriateness of using or
+redistributing the Work and assume any risks associated with Your
+exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise, unless
+required by applicable law (such as deliberate and grossly negligent
+acts) or agreed to in writing, shall any Contributor be liable to You
+for damages, including any direct, indirect, special, incidental, or
+consequential damages of any character arising as a result of this
+License or out of the use or inability to use the Work (including but
+not limited to damages for loss of goodwill, work stoppage, computer
+failure or malfunction, or any and all other commercial damages or
+losses), even if such Contributor has been advised of the possibility
+of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer, and
+charge a fee for, acceptance of support, warranty, indemnity, or other
+liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only on
+Your own behalf and on Your sole responsibility, not on behalf of any
+other Contributor, and only if You agree to indemnify, defend, and
+hold each Contributor harmless for any liability incurred by, or
+claims asserted against, such Contributor by reason of your accepting
+any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+APPENDIX: How to apply the Apache License to your work
+
+To apply the Apache License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "[]" replaced
+with your own identifying information. (Don't include the brackets!)
+The text should be enclosed in the appropriate comment syntax for the
+file format. We also recommend that a file or class name and
+description of purpose be included on the same "printed page" as the
+copyright notice for easier identification within third-party
+archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff -Naur ../jemalloc-3.0.0.orig/include/jemalloc/internal/atomic.h ./include/jemalloc/internal/atomic.h
--- ../jemalloc-3.0.0.orig/include/jemalloc/internal/atomic.h 2012-05-12 02:50:38.000000000 +0200
+++ ./include/jemalloc/internal/atomic.h 2012-05-18 15:55:34.457212405 +0200
@@ -242,6 +242,33 @@
return (__sync_sub_and_fetch(p, x));
}
+#elif (defined(__ppc__) || defined(__PPC__))
+// Code fetched from the boost library
+//
+JEMALLOC_INLINE uint32_t
+atomic_add_uint32(uint32_t *p, uint32_t x)
+{
+ uint32_t prev, temp;
+
+ asm volatile ("0:\n\t" // retry local label
+ "lwarx %0,0,%2\n\t" // load prev and reserve
+ "add %1,%0,%3\n\t" // temp = prev + x
+ "stwcx. %1,0,%2\n\t" // conditionally store
+ "bne- 0b" // start over if we lost
+ // the reservation
+ //XXX find a cleaner way to define the temp
+ //it's not an output
+ : "=&r" (prev), "=&r" (temp) // output, temp
+ : "b" (p), "r" (x) // inputs
+ : "memory", "cc"); // clobbered
+ return temp;
+}
+
+JEMALLOC_INLINE uint32_t
+atomic_sub_uint32(uint32_t *p, uint32_t x)
+{
+ return atomic_add_uint32(p, -x);
+}
#else
# error "Missing implementation for 32-bit atomic operations"
#endif

View File

@ -1,22 +0,0 @@
From upstream git:
http://www.canonware.com/cgi-bin/gitweb.cgi?p=jemalloc.git;a=patch;h=5c710cee783a44061fa2c467ffd8984b8047b90e
diff -Naur ../jemalloc-3.0.0.orig/src/jemalloc.c ./src/jemalloc.c
--- ../jemalloc-3.0.0.orig/src/jemalloc.c 2012-05-12 02:50:38.000000000 +0200
+++ ./src/jemalloc.c 2012-05-24 09:25:07.371417566 +0200
@@ -1262,11 +1262,10 @@
* passed an extra argument for the caller return address, which will be
* ignored.
*/
-JEMALLOC_EXPORT void (* const __free_hook)(void *ptr) = je_free;
-JEMALLOC_EXPORT void *(* const __malloc_hook)(size_t size) = je_malloc;
-JEMALLOC_EXPORT void *(* const __realloc_hook)(void *ptr, size_t size) =
- je_realloc;
-JEMALLOC_EXPORT void *(* const __memalign_hook)(size_t alignment, size_t size) =
+JEMALLOC_EXPORT void (* __free_hook)(void *ptr) = je_free;
+JEMALLOC_EXPORT void *(* __malloc_hook)(size_t size) = je_malloc;
+JEMALLOC_EXPORT void *(* __realloc_hook)(void *ptr, size_t size) = je_realloc;
+JEMALLOC_EXPORT void *(* __memalign_hook)(size_t alignment, size_t size) =
je_memalign;
#endif

View File

@ -1,11 +0,0 @@
--- Makefile.in.orig 2012-05-14 08:25:41.859295446 +0200
+++ Makefile.in 2012-05-14 08:25:58.577353251 +0200
@@ -69,7 +69,7 @@
LIBJEMALLOC := $(LIBPREFIX)jemalloc$(install_suffix)
# Lists of files.
-BINS := $(srcroot)bin/pprof $(objroot)bin/jemalloc.sh
+BINS := $(objroot)bin/jemalloc.sh
CHDRS := $(objroot)include/jemalloc/jemalloc$(install_suffix).h \
$(objroot)include/jemalloc/jemalloc_defs$(install_suffix).h
CSRCS := $(srcroot)src/jemalloc.c $(srcroot)src/arena.c $(srcroot)src/atomic.c \

View File

@ -1,11 +0,0 @@
--- Makefile.in.orig 2014-02-26 01:49:15.000000000 +0100
+++ Makefile.in 2014-03-28 08:48:56.682371135 +0100
@@ -73,7 +73,7 @@
LIBJEMALLOC := $(LIBPREFIX)jemalloc$(install_suffix)
# Lists of files.
-BINS := $(srcroot)bin/pprof $(objroot)bin/jemalloc.sh
+BINS := $(objroot)bin/jemalloc.sh
C_HDRS := $(objroot)include/jemalloc/jemalloc$(install_suffix).h
C_SRCS := $(srcroot)src/jemalloc.c $(srcroot)src/arena.c \
$(srcroot)src/atomic.c $(srcroot)src/base.c $(srcroot)src/bitmap.c \

View File

@ -1,13 +0,0 @@
--- configure.old 2014-03-31 18:38:51.000000000 +0200
+++ configure 2014-04-01 12:20:37.723062342 +0200
@@ -4694,10 +4694,6 @@
fi
;;
powerpc)
- cat >>confdefs.h <<_ACEOF
-#define HAVE_ALTIVEC
-_ACEOF
-
;;
*)
;;

View File

@ -1,200 +0,0 @@
From 5ef33a9f2b9f4fb56553529f7b31f4f5f57ce014 Mon Sep 17 00:00:00 2001
From: Jason Evans <jasone@canonware.com>
Date: Wed, 19 Aug 2015 14:12:05 -0700
Subject: [PATCH] Don't bitshift by negative amounts.
Don't bitshift by negative amounts when encoding/decoding run sizes in
chunk header maps. This affected systems with page sizes greater than 8
KiB.
Reported by Ingvar Hagelund <ingvar@redpill-linpro.com>.
---
ChangeLog | 6 ++++
include/jemalloc/internal/arena.h | 48 ++++++++++++++++++++++-----
include/jemalloc/internal/private_symbols.txt | 2 ++
src/arena.c | 7 ++--
4 files changed, 50 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0cf887c..c98179c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,12 @@ brevity. Much more detail can be found in the git revision history:
https://github.com/jemalloc/jemalloc
+* 4.x.x (XXX)
+
+ Bug fixes:
+ - Don't bitshift by negative amounts when encoding/decoding run sizes in chunk
+ header maps. This affected systems with page sizes greater than 8 KiB.
+
* 4.0.0 (August 17, 2015)
This version contains many speed and space optimizations, both minor and
diff --git a/include/jemalloc/internal/arena.h b/include/jemalloc/internal/arena.h
index cb015ee..2347213 100644
--- a/include/jemalloc/internal/arena.h
+++ b/include/jemalloc/internal/arena.h
@@ -519,6 +519,7 @@ arena_chunk_map_misc_t *arena_run_to_miscelm(arena_run_t *run);
size_t *arena_mapbitsp_get(arena_chunk_t *chunk, size_t pageind);
size_t arena_mapbitsp_read(size_t *mapbitsp);
size_t arena_mapbits_get(arena_chunk_t *chunk, size_t pageind);
+size_t arena_mapbits_size_decode(size_t mapbits);
size_t arena_mapbits_unallocated_size_get(arena_chunk_t *chunk,
size_t pageind);
size_t arena_mapbits_large_size_get(arena_chunk_t *chunk, size_t pageind);
@@ -530,6 +531,7 @@ size_t arena_mapbits_decommitted_get(arena_chunk_t *chunk, size_t pageind);
size_t arena_mapbits_large_get(arena_chunk_t *chunk, size_t pageind);
size_t arena_mapbits_allocated_get(arena_chunk_t *chunk, size_t pageind);
void arena_mapbitsp_write(size_t *mapbitsp, size_t mapbits);
+size_t arena_mapbits_size_encode(size_t size);
void arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind,
size_t size, size_t flags);
void arena_mapbits_unallocated_size_set(arena_chunk_t *chunk, size_t pageind,
@@ -653,13 +655,28 @@ arena_mapbits_get(arena_chunk_t *chunk, size_t pageind)
}
JEMALLOC_ALWAYS_INLINE size_t
+arena_mapbits_size_decode(size_t mapbits)
+{
+ size_t size;
+
+ if (CHUNK_MAP_SIZE_SHIFT > 0)
+ size = (mapbits & CHUNK_MAP_SIZE_MASK) >> CHUNK_MAP_SIZE_SHIFT;
+ else if (CHUNK_MAP_SIZE_SHIFT == 0)
+ size = mapbits & CHUNK_MAP_SIZE_MASK;
+ else
+ size = (mapbits & CHUNK_MAP_SIZE_MASK) << -CHUNK_MAP_SIZE_SHIFT;
+
+ return (size);
+}
+
+JEMALLOC_ALWAYS_INLINE size_t
arena_mapbits_unallocated_size_get(arena_chunk_t *chunk, size_t pageind)
{
size_t mapbits;
mapbits = arena_mapbits_get(chunk, pageind);
assert((mapbits & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) == 0);
- return ((mapbits & CHUNK_MAP_SIZE_MASK) >> CHUNK_MAP_SIZE_SHIFT);
+ return (arena_mapbits_size_decode(mapbits));
}
JEMALLOC_ALWAYS_INLINE size_t
@@ -670,7 +687,7 @@ arena_mapbits_large_size_get(arena_chunk_t *chunk, size_t pageind)
mapbits = arena_mapbits_get(chunk, pageind);
assert((mapbits & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) ==
(CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED));
- return ((mapbits & CHUNK_MAP_SIZE_MASK) >> CHUNK_MAP_SIZE_SHIFT);
+ return (arena_mapbits_size_decode(mapbits));
}
JEMALLOC_ALWAYS_INLINE size_t
@@ -754,6 +771,22 @@ arena_mapbitsp_write(size_t *mapbitsp, size_t mapbits)
*mapbitsp = mapbits;
}
+JEMALLOC_ALWAYS_INLINE size_t
+arena_mapbits_size_encode(size_t size)
+{
+ size_t mapbits;
+
+ if (CHUNK_MAP_SIZE_SHIFT > 0)
+ mapbits = size << CHUNK_MAP_SIZE_SHIFT;
+ else if (CHUNK_MAP_SIZE_SHIFT == 0)
+ mapbits = size;
+ else
+ mapbits = size >> -CHUNK_MAP_SIZE_SHIFT;
+
+ assert((mapbits & ~CHUNK_MAP_SIZE_MASK) == 0);
+ return (mapbits);
+}
+
JEMALLOC_ALWAYS_INLINE void
arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind, size_t size,
size_t flags)
@@ -761,11 +794,10 @@ arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind, size_t size,
size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind);
assert((size & PAGE_MASK) == 0);
- assert(((size << CHUNK_MAP_SIZE_SHIFT) & ~CHUNK_MAP_SIZE_MASK) == 0);
assert((flags & CHUNK_MAP_FLAGS_MASK) == flags);
assert((flags & CHUNK_MAP_DECOMMITTED) == 0 || (flags &
(CHUNK_MAP_DIRTY|CHUNK_MAP_UNZEROED)) == 0);
- arena_mapbitsp_write(mapbitsp, (size << CHUNK_MAP_SIZE_SHIFT) |
+ arena_mapbitsp_write(mapbitsp, arena_mapbits_size_encode(size) |
CHUNK_MAP_BININD_INVALID | flags);
}
@@ -777,10 +809,9 @@ arena_mapbits_unallocated_size_set(arena_chunk_t *chunk, size_t pageind,
size_t mapbits = arena_mapbitsp_read(mapbitsp);
assert((size & PAGE_MASK) == 0);
- assert(((size << CHUNK_MAP_SIZE_SHIFT) & ~CHUNK_MAP_SIZE_MASK) == 0);
assert((mapbits & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) == 0);
- arena_mapbitsp_write(mapbitsp, (size << CHUNK_MAP_SIZE_SHIFT) | (mapbits
- & ~CHUNK_MAP_SIZE_MASK));
+ arena_mapbitsp_write(mapbitsp, arena_mapbits_size_encode(size) |
+ (mapbits & ~CHUNK_MAP_SIZE_MASK));
}
JEMALLOC_ALWAYS_INLINE void
@@ -799,11 +830,10 @@ arena_mapbits_large_set(arena_chunk_t *chunk, size_t pageind, size_t size,
size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind);
assert((size & PAGE_MASK) == 0);
- assert(((size << CHUNK_MAP_SIZE_SHIFT) & ~CHUNK_MAP_SIZE_MASK) == 0);
assert((flags & CHUNK_MAP_FLAGS_MASK) == flags);
assert((flags & CHUNK_MAP_DECOMMITTED) == 0 || (flags &
(CHUNK_MAP_DIRTY|CHUNK_MAP_UNZEROED)) == 0);
- arena_mapbitsp_write(mapbitsp, (size << CHUNK_MAP_SIZE_SHIFT) |
+ arena_mapbitsp_write(mapbitsp, arena_mapbits_size_encode(size) |
CHUNK_MAP_BININD_INVALID | flags | CHUNK_MAP_LARGE |
CHUNK_MAP_ALLOCATED);
}
diff --git a/include/jemalloc/internal/private_symbols.txt b/include/jemalloc/internal/private_symbols.txt
index dbf6aa7..ed1f6c2 100644
--- a/include/jemalloc/internal/private_symbols.txt
+++ b/include/jemalloc/internal/private_symbols.txt
@@ -50,6 +50,8 @@ arena_mapbits_large_size_get
arena_mapbitsp_get
arena_mapbitsp_read
arena_mapbitsp_write
+arena_mapbits_size_decode
+arena_mapbits_size_encode
arena_mapbits_small_runind_get
arena_mapbits_small_set
arena_mapbits_unallocated_set
diff --git a/src/arena.c b/src/arena.c
index af48b39..bd76e96 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -39,7 +39,7 @@ JEMALLOC_INLINE_C arena_chunk_map_misc_t *
arena_miscelm_key_create(size_t size)
{
- return ((arena_chunk_map_misc_t *)((size << CHUNK_MAP_SIZE_SHIFT) |
+ return ((arena_chunk_map_misc_t *)(arena_mapbits_size_encode(size) |
CHUNK_MAP_KEY));
}
@@ -58,8 +58,7 @@ arena_miscelm_key_size_get(const arena_chunk_map_misc_t *miscelm)
assert(arena_miscelm_is_key(miscelm));
- return (((uintptr_t)miscelm & CHUNK_MAP_SIZE_MASK) >>
- CHUNK_MAP_SIZE_SHIFT);
+ return (arena_mapbits_size_decode((uintptr_t)miscelm));
}
JEMALLOC_INLINE_C size_t
@@ -73,7 +72,7 @@ arena_miscelm_size_get(arena_chunk_map_misc_t *miscelm)
chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(miscelm);
pageind = arena_miscelm_to_pageind(miscelm);
mapbits = arena_mapbits_get(chunk, pageind);
- return ((mapbits & CHUNK_MAP_SIZE_MASK) >> CHUNK_MAP_SIZE_SHIFT);
+ return (arena_mapbits_size_decode(mapbits));
}
JEMALLOC_INLINE_C int

View File

@ -1,117 +0,0 @@
From 21523297fcd72128c14b40ebefbf8ccf114fbede Mon Sep 17 00:00:00 2001
From: Jason Evans <jasone@canonware.com>
Date: Thu, 17 Sep 2015 15:27:28 -0700
Subject: [PATCH] Add mallocx() OOM tests.
---
src/jemalloc.c | 2 ++
test/integration/mallocx.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 72 insertions(+)
diff --git a/src/jemalloc.c b/src/jemalloc.c
index 49c5f2a..5a2d324 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -1923,6 +1923,7 @@ imallocx_flags_decode_hard(tsd_t *tsd, size_t size, int flags, size_t *usize,
*alignment = MALLOCX_ALIGN_GET_SPECIFIED(flags);
*usize = sa2u(size, *alignment);
}
+ assert(*usize != 0);
*zero = MALLOCX_ZERO_GET(flags);
if ((flags & MALLOCX_TCACHE_MASK) != 0) {
if ((flags & MALLOCX_TCACHE_MASK) == MALLOCX_TCACHE_NONE)
@@ -2267,6 +2268,7 @@ ixallocx_prof(tsd_t *tsd, void *ptr, size_t old_usize, size_t size,
*/
usize_max = (alignment == 0) ? s2u(size+extra) : sa2u(size+extra,
alignment);
+ assert(usize_max != 0);
tctx = prof_alloc_prep(tsd, usize_max, prof_active, false);
if (unlikely((uintptr_t)tctx != (uintptr_t)1U)) {
usize = ixallocx_prof_sample(ptr, old_usize, size, extra,
diff --git a/test/integration/mallocx.c b/test/integration/mallocx.c
index 4b0e33f..3973938 100644
--- a/test/integration/mallocx.c
+++ b/test/integration/mallocx.c
@@ -1,5 +1,74 @@
#include "test/jemalloc_test.h"
+static unsigned
+get_nsizes_impl(const char *cmd)
+{
+ unsigned ret;
+ size_t z;
+
+ z = sizeof(unsigned);
+ assert_d_eq(mallctl(cmd, &ret, &z, NULL, 0), 0,
+ "Unexpected mallctl(\"%s\", ...) failure", cmd);
+
+ return (ret);
+}
+
+static unsigned
+get_nhuge(void)
+{
+
+ return (get_nsizes_impl("arenas.nhchunks"));
+}
+
+static size_t
+get_size_impl(const char *cmd, size_t ind)
+{
+ size_t ret;
+ size_t z;
+ size_t mib[4];
+ size_t miblen = 4;
+
+ z = sizeof(size_t);
+ assert_d_eq(mallctlnametomib(cmd, mib, &miblen),
+ 0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
+ mib[2] = ind;
+ z = sizeof(size_t);
+ assert_d_eq(mallctlbymib(mib, miblen, &ret, &z, NULL, 0),
+ 0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
+
+ return (ret);
+}
+
+static size_t
+get_huge_size(size_t ind)
+{
+
+ return (get_size_impl("arenas.hchunk.0.size", ind));
+}
+
+TEST_BEGIN(test_oom)
+{
+ size_t hugemax, size, alignment;
+
+ hugemax = get_huge_size(get_nhuge()-1);
+
+ /* In practice hugemax is too large to be allocated. */
+ assert_ptr_null(mallocx(hugemax, 0),
+ "Expected OOM for mallocx(size=%#zx, 0)", hugemax);
+
+#if LG_SIZEOF_PTR == 3
+ size = ZU(0x8000000000000000);
+ alignment = ZU(0x8000000000000000);
+#else
+ size = ZU(0x80000000);
+ alignment = ZU(0x80000000);
+#endif
+ assert_ptr_null(mallocx(size, MALLOCX_ALIGN(alignment)),
+ "Expected OOM for mallocx(size=%#zx, MALLOCX_ALIGN(%#zx)", size,
+ alignment);
+}
+TEST_END
+
TEST_BEGIN(test_basic)
{
#define MAXSZ (((size_t)1) << 26)
@@ -96,6 +165,7 @@ main(void)
{
return (test(
+ test_oom,
test_basic,
test_alignment_and_size));
}

View File

@ -1,11 +0,0 @@
--- configure.orig 2016-08-03 12:11:08.927542973 +0200
+++ configure 2016-08-03 12:11:31.087833041 +0200
@@ -7105,7 +7105,7 @@
GetSystemInfo(&si);
result = si.dwPageSize;
#else
- result = sysconf(_SC_PAGESIZE);
+ result = 65536
#endif
if (result == -1) {
return 1;

View File

@ -1,108 +0,0 @@
From 2c53faf352ca7722f1a776c8c381b01da5b4fa96 Mon Sep 17 00:00:00 2001
From: Jason Evans <jasone@canonware.com>
Date: Fri, 28 Oct 2016 10:44:39 -0700
Subject: [PATCH] Periodically purge in memory-intensive integration tests.
This resolves #393.
---
test/integration/aligned_alloc.c | 13 ++++++++++---
test/integration/mallocx.c | 7 +++++++
test/integration/posix_memalign.c | 13 ++++++++++---
3 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/test/integration/aligned_alloc.c b/test/integration/aligned_alloc.c
index 6090014..80bb38f 100644
--- a/test/integration/aligned_alloc.c
+++ b/test/integration/aligned_alloc.c
@@ -1,9 +1,7 @@
#include "test/jemalloc_test.h"
#define CHUNK 0x400000
-/* #define MAXALIGN ((size_t)UINT64_C(0x80000000000)) */
-#define MAXALIGN ((size_t)0x2000000LU)
-#define NITER 4
+#define MAXALIGN (((size_t)1) << 25)
TEST_BEGIN(test_alignment_errors)
{
@@ -74,6 +72,7 @@ TEST_END
TEST_BEGIN(test_alignment_and_size)
{
+#define NITER 4
size_t alignment, size, total;
unsigned i;
void *ps[NITER];
@@ -110,7 +109,15 @@ TEST_BEGIN(test_alignment_and_size)
}
}
}
+ /*
+ * On systems which can't merge extents, this test generates a
+ * lot of dirty memory very quickly. Purge between cycles to
+ * avoid potential OOM on e.g. 32-bit Windows.
+ */
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
}
+#undef NITER
}
TEST_END
diff --git a/test/integration/mallocx.c b/test/integration/mallocx.c
index 55e1a09..69ce781 100644
--- a/test/integration/mallocx.c
+++ b/test/integration/mallocx.c
@@ -196,6 +196,13 @@ TEST_BEGIN(test_alignment_and_size)
}
}
}
+ /*
+ * On systems which can't merge extents, this test generates a
+ * lot of dirty memory very quickly. Purge between cycles to
+ * avoid potential OOM on e.g. 32-bit Windows.
+ */
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
}
#undef MAXALIGN
#undef NITER
diff --git a/test/integration/posix_memalign.c b/test/integration/posix_memalign.c
index 19741c6..171bcea 100644
--- a/test/integration/posix_memalign.c
+++ b/test/integration/posix_memalign.c
@@ -1,9 +1,7 @@
#include "test/jemalloc_test.h"
#define CHUNK 0x400000
-/* #define MAXALIGN ((size_t)UINT64_C(0x80000000000)) */
-#define MAXALIGN ((size_t)0x2000000LU)
-#define NITER 4
+#define MAXALIGN (((size_t)1) << 25)
TEST_BEGIN(test_alignment_errors)
{
@@ -66,6 +64,7 @@ TEST_END
TEST_BEGIN(test_alignment_and_size)
{
+#define NITER 4
size_t alignment, size, total;
unsigned i;
int err;
@@ -104,7 +103,15 @@ TEST_BEGIN(test_alignment_and_size)
}
}
}
+ /*
+ * On systems which can't merge extents, this test generates a
+ * lot of dirty memory very quickly. Purge between cycles to
+ * avoid potential OOM on e.g. 32-bit Windows.
+ */
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
}
+#undef NITER
}
TEST_END

View File

@ -1,28 +0,0 @@
From eaecaad8ea9fd9cd8b57e49834b5e3332f911c40 Mon Sep 17 00:00:00 2001
From: Jason Evans <jasone@canonware.com>
Date: Fri, 28 Oct 2016 11:00:36 -0700
Subject: [PATCH] Periodically purge in memory-intensive integration tests.
This resolves #393.
---
test/integration/mallocx.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/test/integration/mallocx.c b/test/integration/mallocx.c
index 69ce781..79ab494 100644
--- a/test/integration/mallocx.c
+++ b/test/integration/mallocx.c
@@ -139,6 +139,13 @@ TEST_BEGIN(test_basic)
rsz = sallocx(p, 0);
assert_zu_eq(nsz, rsz, "nallocx()/sallocx() rsize mismatch");
dallocx(p, 0);
+ /*
+ * On systems which can't merge extents, this test generates a
+ * lot of dirty memory very quickly. Purge between cycles to
+ * avoid potential OOM on e.g. 32-bit Windows.
+ */
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
}
#undef MAXSZ
}

View File

@ -1,201 +0,0 @@
From b99c72f3d29e3590ae81959922d0032a29dbace9 Mon Sep 17 00:00:00 2001
From: Jason Evans <jasone@canonware.com>
Date: Fri, 28 Oct 2016 11:23:24 -0700
Subject: [PATCH] Reduce memory requirements for regression tests.
This is intended to drop memory usage to a level that AppVeyor test
instances can handle.
This resolves #393.
---
test/integration/aligned_alloc.c | 23 +++++++++++++-------
test/integration/mallocx.c | 44 ++++++++++++++++++++++-----------------
test/integration/posix_memalign.c | 23 +++++++++++++-------
3 files changed, 55 insertions(+), 35 deletions(-)
diff --git a/test/integration/aligned_alloc.c b/test/integration/aligned_alloc.c
index 80bb38f..5843842 100644
--- a/test/integration/aligned_alloc.c
+++ b/test/integration/aligned_alloc.c
@@ -1,7 +1,20 @@
#include "test/jemalloc_test.h"
#define CHUNK 0x400000
-#define MAXALIGN (((size_t)1) << 25)
+#define MAXALIGN (((size_t)1) << 23)
+
+/*
+ * On systems which can't merge extents, tests that call this function generate
+ * a lot of dirty memory very quickly. Purging between cycles mitigates
+ * potential OOM on e.g. 32-bit Windows.
+ */
+static void
+purge(void)
+{
+
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
+}
TEST_BEGIN(test_alignment_errors)
{
@@ -109,13 +122,7 @@ TEST_BEGIN(test_alignment_and_size)
}
}
}
- /*
- * On systems which can't merge extents, this test generates a
- * lot of dirty memory very quickly. Purge between cycles to
- * avoid potential OOM on e.g. 32-bit Windows.
- */
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl error");
+ purge();
}
#undef NITER
}
diff --git a/test/integration/mallocx.c b/test/integration/mallocx.c
index 79ab494..43b76eb 100644
--- a/test/integration/mallocx.c
+++ b/test/integration/mallocx.c
@@ -50,6 +50,19 @@ get_huge_size(size_t ind)
return (get_size_impl("arenas.hchunk.0.size", ind));
}
+/*
+ * On systems which can't merge extents, tests that call this function generate
+ * a lot of dirty memory very quickly. Purging between cycles mitigates
+ * potential OOM on e.g. 32-bit Windows.
+ */
+static void
+purge(void)
+{
+
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
+}
+
TEST_BEGIN(test_overflow)
{
size_t hugemax;
@@ -96,6 +109,7 @@ TEST_BEGIN(test_oom)
if (ptrs[i] != NULL)
dallocx(ptrs[i], 0);
}
+ purge();
#if LG_SIZEOF_PTR == 3
assert_ptr_null(mallocx(0x8000000000000000ULL,
@@ -113,7 +127,7 @@ TEST_END
TEST_BEGIN(test_basic)
{
-#define MAXSZ (((size_t)1) << 26)
+#define MAXSZ (((size_t)1) << 23)
size_t sz;
for (sz = 1; sz < MAXSZ; sz = nallocx(sz, 0) + 1) {
@@ -122,30 +136,28 @@ TEST_BEGIN(test_basic)
nsz = nallocx(sz, 0);
assert_zu_ne(nsz, 0, "Unexpected nallocx() error");
p = mallocx(sz, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
+ assert_ptr_not_null(p,
+ "Unexpected mallocx(size=%zx, flags=0) error", sz);
rsz = sallocx(p, 0);
assert_zu_ge(rsz, sz, "Real size smaller than expected");
assert_zu_eq(nsz, rsz, "nallocx()/sallocx() size mismatch");
dallocx(p, 0);
p = mallocx(sz, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
+ assert_ptr_not_null(p,
+ "Unexpected mallocx(size=%zx, flags=0) error", sz);
dallocx(p, 0);
nsz = nallocx(sz, MALLOCX_ZERO);
assert_zu_ne(nsz, 0, "Unexpected nallocx() error");
p = mallocx(sz, MALLOCX_ZERO);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
+ assert_ptr_not_null(p,
+ "Unexpected mallocx(size=%zx, flags=MALLOCX_ZERO) error",
+ nsz);
rsz = sallocx(p, 0);
assert_zu_eq(nsz, rsz, "nallocx()/sallocx() rsize mismatch");
dallocx(p, 0);
- /*
- * On systems which can't merge extents, this test generates a
- * lot of dirty memory very quickly. Purge between cycles to
- * avoid potential OOM on e.g. 32-bit Windows.
- */
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl error");
+ purge();
}
#undef MAXSZ
}
@@ -153,7 +165,7 @@ TEST_END
TEST_BEGIN(test_alignment_and_size)
{
-#define MAXALIGN (((size_t)1) << 25)
+#define MAXALIGN (((size_t)1) << 23)
#define NITER 4
size_t nsz, rsz, sz, alignment, total;
unsigned i;
@@ -203,13 +215,7 @@ TEST_BEGIN(test_alignment_and_size)
}
}
}
- /*
- * On systems which can't merge extents, this test generates a
- * lot of dirty memory very quickly. Purge between cycles to
- * avoid potential OOM on e.g. 32-bit Windows.
- */
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl error");
+ purge();
}
#undef MAXALIGN
#undef NITER
diff --git a/test/integration/posix_memalign.c b/test/integration/posix_memalign.c
index 171bcea..e22e102 100644
--- a/test/integration/posix_memalign.c
+++ b/test/integration/posix_memalign.c
@@ -1,7 +1,20 @@
#include "test/jemalloc_test.h"
#define CHUNK 0x400000
-#define MAXALIGN (((size_t)1) << 25)
+#define MAXALIGN (((size_t)1) << 23)
+
+/*
+ * On systems which can't merge extents, tests that call this function generate
+ * a lot of dirty memory very quickly. Purging between cycles mitigates
+ * potential OOM on e.g. 32-bit Windows.
+ */
+static void
+purge(void)
+{
+
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
+}
TEST_BEGIN(test_alignment_errors)
{
@@ -103,13 +116,7 @@ TEST_BEGIN(test_alignment_and_size)
}
}
}
- /*
- * On systems which can't merge extents, this test generates a
- * lot of dirty memory very quickly. Purge between cycles to
- * avoid potential OOM on e.g. 32-bit Windows.
- */
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl error");
+ purge();
}
#undef NITER
}

View File

@ -1,13 +0,0 @@
--- jemalloc-2.2.5/include/jemalloc/internal/atomic.h.orig 2012-04-21 10:50:06.000000000 -0400
+++ jemalloc-2.2.5/include/jemalloc/internal/atomic.h 2012-04-21 10:50:21.000000000 -0400
@@ -105,7 +105,9 @@
/******************************************************************************/
/* 32-bit operations. */
-#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+#if ( defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) \
+ || defined(__ARM_ARCH_5T__) \
+ || defined(__ARM_ARCH_5TE__) )
JEMALLOC_INLINE uint32_t
atomic_add_uint32(uint32_t *p, uint32_t x)
{