1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-25 07:49:18 +00:00

FreeBSD: Update use of UMA-related symbols in arc_available_memory

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 <behlendorf1@llnl.gov>
Signed-off-by: Bojan Novković <bnovkov@FreeBSD.org>
Closes #16230
This commit is contained in:
bnovkov 2024-06-07 03:11:00 +02:00 committed by GitHub
parent 4de260efe3
commit 20c8bdd85e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {