[all-commits] [llvm/llvm-project] 99bc98: [Support] Add MemoryBuffer::randomAccessIfMmap() (...

Roy Shi via All-commits all-commits at lists.llvm.org
Wed May 27 12:21:42 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 99bc986c527a9a98c85d792cfd99e0518cc1615d
      https://github.com/llvm/llvm-project/commit/99bc986c527a9a98c85d792cfd99e0518cc1615d
  Author: Roy Shi <royitaqi at users.noreply.github.com>
  Date:   2026-05-27 (Wed, 27 May 2026)

  Changed paths:
    M llvm/include/llvm/Support/FileSystem.h
    M llvm/include/llvm/Support/MemoryBuffer.h
    M llvm/lib/Support/MemoryBuffer.cpp
    M llvm/lib/Support/Unix/Path.inc
    M llvm/lib/Support/Windows/Path.inc

  Log Message:
  -----------
  [Support] Add MemoryBuffer::randomAccessIfMmap() (#199265)

For read-only MemoryBuffer_MMap, advise the kernel that access pattern
will be random, disabling readahead. This calls `madvise(MADV_RANDOM)`
on *NIX. This function should not be called on a writable buffer.

The implementation follows existing pattern in
`mapped_file_region::dontNeedImpl()` and
`mapped_file_region::willNeedImpl()`.

See intended usage: https://github.com/llvm/llvm-project/pull/199230



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list