mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-02 01:34:38 +03:00
fix performance bug in mi_bchunk_try_find _and_clearNX
This commit is contained in:
parent
4c562f392a
commit
64aaf9d88f
1 changed files with 1 additions and 1 deletions
|
@ -804,7 +804,7 @@ mi_decl_noinline static bool mi_bchunk_try_find_and_clearNX(mi_bchunk_t* chunk,
|
||||||
const size_t post = mi_bfield_clz(~b);
|
const size_t post = mi_bfield_clz(~b);
|
||||||
if (post > 0) {
|
if (post > 0) {
|
||||||
const size_t pre = mi_bfield_ctz(~mi_atomic_load_relaxed(&chunk->bfields[i+1]));
|
const size_t pre = mi_bfield_ctz(~mi_atomic_load_relaxed(&chunk->bfields[i+1]));
|
||||||
if (post + pre <= n) {
|
if (post + pre >= n) {
|
||||||
// it fits -- try to claim it atomically
|
// it fits -- try to claim it atomically
|
||||||
const size_t cidx = (i*MI_BFIELD_BITS) + (MI_BFIELD_BITS - post);
|
const size_t cidx = (i*MI_BFIELD_BITS) + (MI_BFIELD_BITS - post);
|
||||||
if (mi_bchunk_try_clearNX(chunk, cidx, n, NULL)) {
|
if (mi_bchunk_try_clearNX(chunk, cidx, n, NULL)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue