[all-commits] [llvm/llvm-project] dbf047: [scudo] Fix the logic of pushing blocks of BatchClass

ChiaHungDuan via All-commits all-commits at lists.llvm.org
Wed Feb 22 14:13:00 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dbf047454fcdf391dec9eebbbdb4e5b12f4b42f8
      https://github.com/llvm/llvm-project/commit/dbf047454fcdf391dec9eebbbdb4e5b12f4b42f8
  Author: Chia-hung Duan <chiahungduan at google.com>
  Date:   2023-02-22 (Wed, 22 Feb 2023)

  Changed paths:
    M compiler-rt/lib/scudo/standalone/primary32.h
    M compiler-rt/lib/scudo/standalone/primary64.h

  Log Message:
  -----------
  [scudo] Fix the logic of pushing blocks of BatchClass

BatchClass is used to manage the free blocks for each size class. It's a
little bit tricky when it has to manage the free blocks of BatchClass.
In general, BatchClass block records the addresses of free blocks. In
order not to waste additional block to record the blocks in BatchClass,
it's self contained, i.e., it'll record its own address. The safety is
maintained by 2 preconditions,

  1. If a block is used to record other BatchClass blocks, it'll also
     record the address itself
  2. While allocating free blocks, all the recorded blcoks will be
     allocated together, which means there's no partial allocation

This CL fixes the violation of 1. and then we can push the free blocks
without having to push them in batches.

Differential Revision: https://reviews.llvm.org/D141956


  Commit: 16bffb7e2f683c70bf0d55dbee8f448188a9e3dd
      https://github.com/llvm/llvm-project/commit/16bffb7e2f683c70bf0d55dbee8f448188a9e3dd
  Author: Chia-hung Duan <chiahungduan at google.com>
  Date:   2023-02-22 (Wed, 22 Feb 2023)

  Changed paths:
    M compiler-rt/lib/scudo/standalone/primary32.h
    M compiler-rt/lib/scudo/standalone/primary64.h

  Log Message:
  -----------
  [scudo] Ensure all blocks are put in the correct group

While populating new blocks, we didn't always put them into their own
groups because that needs additional sort for an almost-sorted new
blocks array. However, ensuring all blocks are placed in the right group
enables the fast identifying of unused pages in a group by simply
accouting the number of free blocks are there. Therefore, this commit is
used to set up the invariant for future optimizations.

Differential Revision: https://reviews.llvm.org/D141957


Compare: https://github.com/llvm/llvm-project/compare/55bc18a7de91...16bffb7e2f68


More information about the All-commits mailing list