diff options
author | Alexander Motin <[email protected]> | 2021-05-25 21:38:34 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-25 19:38:34 -0600 |
commit | 211cee4fcf785935a94d038ee6656267adc2b223 (patch) | |
tree | 0dcebc47ab1455800dd5629a10d05273a1a3fa1c /module | |
parent | 90c05245350334a7d013c5e394dc06a17d90ccec (diff) |
FreeBSD: avoid memory allocation in arc_prune_async
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Alexander Motin <[email protected]>
Closes #12049
Diffstat (limited to 'module')
-rw-r--r-- | module/os/freebsd/zfs/arc_os.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/module/os/freebsd/zfs/arc_os.c b/module/os/freebsd/zfs/arc_os.c index 201dbc423..05377bb7e 100644 --- a/module/os/freebsd/zfs/arc_os.c +++ b/module/os/freebsd/zfs/arc_os.c @@ -158,10 +158,9 @@ arc_default_max(uint64_t min, uint64_t allmem) static void arc_prune_task(void *arg) { - int64_t nr_scan = *(int64_t *)arg; + int64_t nr_scan = (intptr_t)arg; arc_reduce_target_size(ptob(nr_scan)); - free(arg, M_TEMP); #if __FreeBSD_version >= 1300139 sx_xlock(&arc_vnlru_lock); vnlru_free_vfsops(nr_scan, &zfs_vfsops, arc_vnlru_marker); @@ -186,13 +185,12 @@ void arc_prune_async(int64_t adjust) { - int64_t *adjustptr; - - if ((adjustptr = malloc(sizeof (int64_t), M_TEMP, M_NOWAIT)) == NULL) - return; - - *adjustptr = adjust; - taskq_dispatch(arc_prune_taskq, arc_prune_task, adjustptr, TQ_SLEEP); +#ifndef __LP64__ + if (adjust > INTPTR_MAX) + adjust = INTPTR_MAX; +#endif + taskq_dispatch(arc_prune_taskq, arc_prune_task, + (void *)(intptr_t)adjust, TQ_SLEEP); ARCSTAT_BUMP(arcstat_prune); } |