[compiler-rt] cc04bbb - [scudo] Fix the calculation of PushedBytesDelta (#95177)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 14:52:33 PDT 2024


Author: ChiaHungDuan
Date: 2024-06-11T14:52:28-07:00
New Revision: cc04bbb2752a0b2a5e7fb41ed1a9d54fbdd3be89

URL: https://github.com/llvm/llvm-project/commit/cc04bbb2752a0b2a5e7fb41ed1a9d54fbdd3be89
DIFF: https://github.com/llvm/llvm-project/commit/cc04bbb2752a0b2a5e7fb41ed1a9d54fbdd3be89.diff

LOG: [scudo] Fix the calculation of PushedBytesDelta (#95177)

BytesInBG is always greater or equal to BG->BytesInBGAtLastCheckpoint.

Note that the bug led to unnecessary attempts of page releasing and
doesn't have critical impact on the correctness.

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/primary64.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index bed2ccb8b992a..8a583bacb4a93 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -1392,7 +1392,7 @@ template <typename Config> class SizeClassAllocator64 {
         continue;
       }
 
-      const uptr PushedBytesDelta = BG->BytesInBGAtLastCheckpoint - BytesInBG;
+      const uptr PushedBytesDelta = BytesInBG - BG->BytesInBGAtLastCheckpoint;
 
       // Given the randomness property, we try to release the pages only if the
       // bytes used by free blocks exceed certain proportion of group size. Note


        


More information about the llvm-commits mailing list