Skip to content

Commit a9056a2

Browse files
committed
MDEV-18946: innodb: {de|}allocate_large_{dodump|dontdump} added
In 1dc78d3 the arguments to a deallocate_large(dontdump=true) was passed a wrong value. To avoid accidential calling large memory function that have DODUMP/DONTDUMP options and missing arguments, the functions have been given distinct names.
1 parent 8678a10 commit a9056a2

File tree

2 files changed

+35
-17
lines changed

2 files changed

+35
-17
lines changed

storage/innobase/buf/buf0buf.cc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,8 +1571,7 @@ buf_chunk_init(
15711571

15721572
DBUG_EXECUTE_IF("ib_buf_chunk_init_fails", return(NULL););
15731573

1574-
chunk->mem = buf_pool->allocator.allocate_large(mem_size,
1575-
&chunk->mem_pfx, true);
1574+
chunk->mem = buf_pool->allocator.allocate_large_dontdump(mem_size, &chunk->mem_pfx);
15761575

15771576
if (UNIV_UNLIKELY(chunk->mem == NULL)) {
15781577

@@ -1865,9 +1864,8 @@ buf_pool_init_instance(
18651864
&block->debug_latch));
18661865
}
18671866

1868-
buf_pool->allocator.deallocate_large(
1869-
chunk->mem, &chunk->mem_pfx, chunk->mem_size(),
1870-
true);
1867+
buf_pool->allocator.deallocate_large_dodump(
1868+
chunk->mem, &chunk->mem_pfx, chunk->mem_size());
18711869
}
18721870
ut_free(buf_pool->chunks);
18731871
buf_pool_mutex_exit(buf_pool);
@@ -2014,8 +2012,8 @@ buf_pool_free_instance(
20142012
ut_d(rw_lock_free(&block->debug_latch));
20152013
}
20162014

2017-
buf_pool->allocator.deallocate_large(
2018-
chunk->mem, &chunk->mem_pfx, chunk->mem_size(), true);
2015+
buf_pool->allocator.deallocate_large_dodump(
2016+
chunk->mem, &chunk->mem_pfx, chunk->mem_size());
20192017
}
20202018

20212019
for (ulint i = BUF_FLUSH_LRU; i < BUF_FLUSH_N_TYPES; ++i) {
@@ -2892,8 +2890,8 @@ buf_pool_resize()
28922890
&block->debug_latch));
28932891
}
28942892

2895-
buf_pool->allocator.deallocate_large(
2896-
chunk->mem, &chunk->mem_pfx, chunk->mem_size(), true);
2893+
buf_pool->allocator.deallocate_large_dodump(
2894+
chunk->mem, &chunk->mem_pfx, chunk->mem_size());
28972895

28982896
sum_freed += chunk->size;
28992897

storage/innobase/include/ut0new.h

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -654,13 +654,18 @@ class ut_allocator {
654654
return(ptr);
655655
}
656656

657+
pointer
658+
allocate_large_dontdump(
659+
size_type n_elements,
660+
ut_new_pfx_t* pfx)
661+
{
662+
return allocate_large(n_elements, pfx, true);
663+
}
657664
/** Free a memory allocated by allocate_large() and trace the
658665
deallocation.
659666
@param[in,out] ptr pointer to memory to free
660667
@param[in] pfx descriptor of the memory, as returned by
661-
allocate_large().
662-
@param[in] dodump if true, advise the OS to include this
663-
memory again if a core dump occurs. */
668+
allocate_large(). */
664669
void
665670
deallocate_large(
666671
pointer ptr,
@@ -669,12 +674,8 @@ class ut_allocator {
669674
pfx
670675
#endif
671676
,
672-
size_tsize,
673-
booldodump = false)
677+
size_tsize)
674678
{
675-
if (dodump) {
676-
ut_dodump(ptr, size);
677-
}
678679
#ifdef UNIV_PFS_MEMORY
679680
if (pfx) {
680681
deallocate_trace(pfx);
@@ -684,8 +685,27 @@ class ut_allocator {
684685
os_mem_free_large(ptr, size);
685686
}
686687

688+
void
689+
deallocate_large_dodump(
690+
pointer ptr,
691+
const ut_new_pfx_t*
687692
#ifdef UNIV_PFS_MEMORY
693+
pfx
694+
#endif
695+
,
696+
size_tsize)
697+
{
698+
ut_dodump(ptr, size);
699+
deallocate_large(ptr,
700+
#ifdef UNIV_PFS_MEMORY
701+
pfx,
702+
#else
703+
NULL,
704+
#endif
705+
size);
706+
}
688707

708+
#ifdef UNIV_PFS_MEMORY
689709
/** Get the performance schema key to use for tracing allocations.
690710
@param[in] file file name of the caller or NULL if unknown
691711
@return performance schema key */

0 commit comments

Comments
 (0)