Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbad9f63

Browse files
[3.13]gh-129748: Update mimalloc to use atomic store for mi_block_set_nextx (GH-134238) (gh-134353)
gh-129748: Update mimalloc to use atomic store for mi_block_set_nextx (GH-134238)(cherry picked from commit317c496)Co-authored-by: Donghee Na <donghee.na@python.org>
1 parent61af847 commitbad9f63

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

‎Include/internal/mimalloc/mimalloc/internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,10 @@ static inline mi_block_t* mi_block_nextx( const void* null, const mi_block_t* bl
634634
mi_track_mem_defined(block,sizeof(mi_block_t));
635635
mi_block_t* next;
636636
#ifdef MI_ENCODE_FREELIST
637-
next = (mi_block_t*)mi_ptr_decode(null, block->next, keys);
637+
next = (mi_block_t*)mi_ptr_decode(null,mi_atomic_load_relaxed(&block->next), keys);
638638
#else
639639
MI_UNUSED(keys);MI_UNUSED(null);
640-
next = (mi_block_t*)block->next;
640+
next = (mi_block_t*)mi_atomic_load_relaxed(&block->next);
641641
#endif
642642
mi_track_mem_noaccess(block,sizeof(mi_block_t));
643643
return next;
@@ -646,10 +646,10 @@ static inline mi_block_t* mi_block_nextx( const void* null, const mi_block_t* bl
646646
staticinlinevoidmi_block_set_nextx(constvoid* null,mi_block_t* block,constmi_block_t* next,constuintptr_t* keys) {
647647
mi_track_mem_undefined(block,sizeof(mi_block_t));
648648
#ifdef MI_ENCODE_FREELIST
649-
block->next =mi_ptr_encode(null, next, keys);
649+
mi_atomic_store_relaxed(&block->next,mi_ptr_encode(null, next, keys));
650650
#else
651651
MI_UNUSED(keys);MI_UNUSED(null);
652-
block->next =(mi_encoded_t)next;
652+
mi_atomic_store_relaxed(&block->next,(mi_encoded_t)next);
653653
#endif
654654
mi_track_mem_noaccess(block,sizeof(mi_block_t));
655655
}

‎Include/internal/mimalloc/mimalloc/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ typedef size_t mi_threadid_t;
235235

236236
// free lists contain blocks
237237
typedefstructmi_block_s {
238-
mi_encoded_tnext;
238+
_Atomic(mi_encoded_t)next;
239239
}mi_block_t;
240240

241241

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp