From 36a2918d24da499a9831e53c41f1fb19882e716d Mon Sep 17 00:00:00 2001 From: sundengyu Date: Thu, 14 Nov 2024 14:20:54 +0800 Subject: [PATCH] fix(arc): do not compute free mem anymore we should leave the compute task to the upper caller Signed-off-by: sundengyu --- include/libuzfs.h | 2 +- lib/libuzfs/libuzfs.c | 4 +--- module/os/linux/zfs/arc_os.c | 7 +------ 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/include/libuzfs.h b/include/libuzfs.h index ec76c44bbd25..0816c1e61c8e 100644 --- a/include/libuzfs.h +++ b/include/libuzfs.h @@ -300,7 +300,7 @@ extern int libuzfs_object_next_block(libuzfs_inode_handle_t *ihp, extern void libuzfs_debug_main(int argc, char **argv); extern void libuzfs_show_stats(void *, int, const seq_file_generator_t *); -extern void libuzfs_config_arc(size_t, size_t, size_t); +extern void libuzfs_config_arc(size_t, size_t); extern void libuzfs_arc_shrink(size_t); void libuzfs_wakeup_arc_evictor(void); #ifdef __cplusplus diff --git a/lib/libuzfs/libuzfs.c b/lib/libuzfs/libuzfs.c index 66d75750ffcc..d560506f5dea 100644 --- a/lib/libuzfs/libuzfs.c +++ b/lib/libuzfs/libuzfs.c @@ -1004,14 +1004,12 @@ libuzfs_get_data(void *arg, uint64_t gen, lr_write_t *lr, char *buf, extern unsigned long zfs_arc_max; extern unsigned long zfs_arc_min; -extern unsigned long zfs_arc_sys_free; void -libuzfs_config_arc(size_t arc_max, size_t arc_min, size_t sys_reserved) +libuzfs_config_arc(size_t arc_max, size_t arc_min) { zfs_arc_min = arc_min; zfs_arc_max = arc_max; - zfs_arc_sys_free = sys_reserved; arc_tuning_update(B_FALSE); } diff --git a/module/os/linux/zfs/arc_os.c b/module/os/linux/zfs/arc_os.c index eb02d4db1627..01c0b756d91e 100644 --- a/module/os/linux/zfs/arc_os.c +++ b/module/os/linux/zfs/arc_os.c @@ -481,12 +481,7 @@ arc_shrink(size_t percent) uint64_t arc_free_memory(void) { - struct sysinfo info; - if (sysinfo(&info) == -1) { - return (0); - } - - return (info.freeram); + return (UINT64_MAX); } void