Discussion:
Valgrind: r16381 - in /trunk: coregrind/m_aspacemgr/aspacemgr-linux.c memcheck/mc_main.c
(too old to reply)
s***@valgrind.org
2017-05-16 06:20:26 UTC
Permalink
Raw Message
Author: sewardj
Date: Tue May 16 07:20:26 2017
New Revision: 16381

Log:
Bug 368507 - valgrind throws std::bad_alloc on memory allocations larger than 34255421416 bytes.
Increase the amount of usable memory from 64GB to 128GB on Linux and Solaris.
(Solaris bits from Ivo Raisr.) OSX is so far unchanged.


Modified:
trunk/coregrind/m_aspacemgr/aspacemgr-linux.c
trunk/memcheck/mc_main.c

Modified: trunk/coregrind/m_aspacemgr/aspacemgr-linux.c
==============================================================================
--- trunk/coregrind/m_aspacemgr/aspacemgr-linux.c (original)
+++ trunk/coregrind/m_aspacemgr/aspacemgr-linux.c Tue May 16 07:20:26 2017
@@ -1620,6 +1620,7 @@

aspacem_minAddr = VG_(clo_aspacem_minAddr);

+ // --- Darwin -------------------------------------------
#if defined(VGO_darwin)

# if VG_WORDSIZE == 4
@@ -1637,6 +1638,7 @@

suggested_clstack_end = -1; // ignored; Mach-O specifies its stack

+ // --- Solaris ------------------------------------------
#elif defined(VGO_solaris)
# if VG_WORDSIZE == 4
/*
@@ -1692,7 +1694,7 @@
| |
|--------------------------------|
| dynamic shared objects |
- |--------------------------------| 0x0000000f_ffffffff
+ |--------------------------------| 0x0000001f_ffffffff
| |
| |
|--------------------------------|
@@ -1702,18 +1704,18 @@
*/

/* Kernel likes to place objects at the end of the address space.
- However accessing memory beyond 64GB makes memcheck slow
+ However accessing memory beyond 128GB makes memcheck slow
(see memcheck/mc_main.c, internal representation). Therefore:
- mmapobj() syscall is emulated so that libraries are subject to
Valgrind's aspacemgr control
- Kernel shared pages (such as schedctl and hrt) are left as they are
because kernel cannot be told where they should be put */
# ifdef ENABLE_INNER
- aspacem_maxAddr = (Addr) 0x00000007ffffffff; // 32GB
- aspacem_vStart = (Addr) 0x0000000400000000; // 16GB
-# else
aspacem_maxAddr = (Addr) 0x0000000fffffffff; // 64GB
aspacem_vStart = (Addr) 0x0000000800000000; // 32GB
+# else
+ aspacem_maxAddr = (Addr) 0x0000001fffffffff; // 128GB
+ aspacem_vStart = (Addr) 0x0000001000000000; // 64GB
# endif
# else
# error "Unknown word size"
@@ -1726,6 +1728,7 @@
suggested_clstack_end = (Addr) 0x37ff0000 - 1; // 64kB below V's text
# endif

+ // --- Linux --------------------------------------------
#else

/* Establish address limits and block out unusable parts
@@ -1736,7 +1739,7 @@
sp_at_startup );

# if VG_WORDSIZE == 8
- aspacem_maxAddr = (Addr)0x1000000000ULL - 1; // 64G
+ aspacem_maxAddr = (Addr)0x2000000000ULL - 1; // 128G
# ifdef ENABLE_INNER
{ Addr cse = VG_PGROUNDDN( sp_at_startup ) - 1;
if (aspacem_maxAddr > cse)
@@ -1751,13 +1754,14 @@
aspacem_vStart = VG_PGROUNDUP(aspacem_minAddr
+ (aspacem_maxAddr - aspacem_minAddr + 1) / 2);
# ifdef ENABLE_INNER
- aspacem_vStart -= 0x10000000; // 256M
+ aspacem_vStart -= 0x20000000; // 512M
# endif

suggested_clstack_end = aspacem_maxAddr - 16*1024*1024ULL
+ VKI_PAGE_SIZE;

#endif
+ // --- (end) --------------------------------------------

aspacem_assert(VG_IS_PAGE_ALIGNED(aspacem_minAddr));
aspacem_assert(VG_IS_PAGE_ALIGNED(aspacem_maxAddr + 1));

Modified: trunk/memcheck/mc_main.c
==============================================================================
--- trunk/memcheck/mc_main.c (original)
+++ trunk/memcheck/mc_main.c Tue May 16 07:20:26 2017
@@ -176,10 +176,10 @@

#else

-/* Just handle the first 64G fast and the rest via auxiliary
+/* Just handle the first 128G fast and the rest via auxiliary
primaries. If you change this, Memcheck will assert at startup.
See the definition of UNALIGNED_OR_HIGH for extensive comments. */
-# define N_PRIMARY_BITS 20
+# define N_PRIMARY_BITS 21

#endif

@@ -8300,11 +8300,11 @@
tl_assert(sizeof(Addr) == 8);
tl_assert(sizeof(UWord) == 8);
tl_assert(sizeof(Word) == 8);
- tl_assert(MAX_PRIMARY_ADDRESS == 0xFFFFFFFFFULL);
- tl_assert(MASK(1) == 0xFFFFFFF000000000ULL);
- tl_assert(MASK(2) == 0xFFFFFFF000000001ULL);
- tl_assert(MASK(4) == 0xFFFFFFF000000003ULL);
- tl_assert(MASK(8) == 0xFFFFFFF000000007ULL);
+ tl_assert(MAX_PRIMARY_ADDRESS == 0x1FFFFFFFFFULL);
+ tl_assert(MASK(1) == 0xFFFFFFE000000000ULL);
+ tl_assert(MASK(2) == 0xFFFFFFE000000001ULL);
+ tl_assert(MASK(4) == 0xFFFFFFE000000003ULL);
+ tl_assert(MASK(8) == 0xFFFFFFE000000007ULL);
# endif

/* Check some assertions to do with the instrumentation machinery. */
Loading...