Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf/5620~1
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf/5620
Choose a head ref
  • 4 commits
  • 5 files changed
  • 2 contributors

Commits on Apr 1, 2025

  1. Improve acounting for memory used by shared hash tables

    pg_shmem_allocations tracks the memory allocated by ShmemInitStruct(),
    but for shared hash tables that covered only the header and hash
    directory.  The remaining parts (segments and buckets) were allocated
    later using ShmemAlloc(), which does not update the shmem accounting.
    Thus, these allocations were not shown in pg_shmem_allocations.
    
    This commit improves the situation by allocating all the hash table
    parts at once, using a single ShmemInitStruct() call. This way the
    ShmemIndex entries (and thus pg_shmem_allocations) better reflect the
    proper size of the hash table.
    
    This affects allocations for private (non-shared) hash tables too, as
    the hash_create() code is shared. For non-shared tables this however
    makes no practical difference.
    
    This changes the alignment a bit. ShmemAlloc() aligns the chunks using
    CACHELINEALIGN(), which means some parts (header, directory, segments)
    were aligned this way. Allocating all parts as a single chunks removes
    this (implicit) alignment. We've considered adding explicit alignment,
    but we've decided not to - it seems to be merely a coincidence due to
    using the ShmemAlloc() API, not due to necessity.
    
    Author: Rahila Syed <[email protected]>
    Reviewed-by: Andres Freund <[email protected]>
    Reviewed-by: Nazir Bilal Yavuz <[email protected]>
    Reviewed-by: Tomas Vondra <[email protected]>
    Discussion: https://postgr.es/m/CAH2L28vHzRankszhqz7deXURxKncxfirnuW68zD7+hVAqaS5GQ@mail.gmail.com
    Rahila authored and Commitfest Bot committed Apr 1, 2025
    Configuration menu
    Copy the full SHA
    91ca951 View commit details
    Browse the repository at this point in the history
  2. Improve accounting for PredXactList, RWConflictPool and PGPROC

    Various places allocated shared memory by first allocating a small chunk
    using ShmemInitStruct(), followed by ShmemAlloc() calls to allocate more
    memory. Unfortunately, ShmemAlloc() does not update ShmemIndex, so this
    affected pg_shmem_allocations - it only shown the initial chunk.
    
    This commit modifies the following allocations, to allocate everything
    as a single chunk, and then split it internally.
    
    - PredXactList
    - RWConflictPool
    - PGPROC structures
    - Fast-Path lock arrays
    
    Author: Rahila Syed <[email protected]>
    Reviewed-by: Andres Freund <[email protected]>
    Reviewed-by: Nazir Bilal Yavuz <[email protected]>
    Reviewed-by: Tomas Vondra <[email protected]>
    Discussion: https://postgr.es/m/CAH2L28vHzRankszhqz7deXURxKncxfirnuW68zD7+hVAqaS5GQ@mail.gmail.com
    Rahila authored and Commitfest Bot committed Apr 1, 2025
    Configuration menu
    Copy the full SHA
    7cfe61e View commit details
    Browse the repository at this point in the history
  3. Add cacheline padding between heavily accessed arrays

    Rahila authored and Commitfest Bot committed Apr 1, 2025
    Configuration menu
    Copy the full SHA
    e84428e View commit details
    Browse the repository at this point in the history
  4. [CF 5620] v9 - Improve monitoring of shared memory allocations

    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/5620
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/CAH2L28vaktm0UXw19y22w+DThcqV80-UKtVfMxPeVw8ro2yTDg@mail.gmail.com
    Author(s): Rahila Syed
    Commitfest Bot committed Apr 1, 2025
    Configuration menu
    Copy the full SHA
    f91b526 View commit details
    Browse the repository at this point in the history
Loading