Skip to content

Commit

Permalink
FreeBSD: Update use of UMA-related symbols in arc_available_memory
Browse files Browse the repository at this point in the history
Recent UMA changes repurposed the use of UMA_MD_SMALL_ALLOC in a way
that breaks arc_available_memory on -CURRENT. This change
ensures that arc_available_memory uses the new symbol
while maintaining compatibility with older FreeBSD releases.
    
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Bojan Novković <[email protected]>
Closes #16230
  • Loading branch information
bnovkov authored Jun 7, 2024
1 parent 4de260e commit 20c8bdd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions module/os/freebsd/zfs/arc_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,17 @@ arc_available_memory(void)
if (n < lowest) {
lowest = n;
}
#if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC)
#if !defined(UMA_MD_SMALL_ALLOC) && !defined(UMA_USE_DMAP)
/*
* If we're on an i386 platform, it's possible that we'll exhaust the
* kernel heap space before we ever run out of available physical
* memory. Most checks of the size of the heap_area compare against
* tune.t_minarmem, which is the minimum available real memory that we
* can have in the system. However, this is generally fixed at 25 pages
* which is so low that it's useless. In this comparison, we seek to
* calculate the total heap-size, and reclaim if more than 3/4ths of the
* heap is allocated. (Or, in the calculation, if less than 1/4th is
* free)
* If we're on a platform without a direct map, it's possible that we'll
* exhaust the kernel heap space before we ever run out of available
* physical memory. Most checks of the size of the heap_area compare
* against tune.t_minarmem, which is the minimum available real memory
* that we can have in the system. However, this is generally fixed at
* 25 pages which is so low that it's useless. In this comparison, we
* seek to calculate the total heap-size, and reclaim if more than
* 3/4ths of the heap is allocated. (Or, in the calculation, if less
* than 1/4th is free)
*/
n = uma_avail() - (long)(uma_limit() / 4);
if (n < lowest) {
Expand Down

0 comments on commit 20c8bdd

Please sign in to comment.