Skip to content

Commit

Permalink
Use vmem_zalloc to silence allocation warning
Browse files Browse the repository at this point in the history
The kmem allocation in zfs_prune_aliases() will trigger a large
allocation warning on systems with 64K pages.  Resolve this by
switching to vmem_alloc() which internally uses kvmalloc() so the
right allocator will be used based on the allocation size.

Reviewed-by: Richard Yao <[email protected]>
Reviewed-by: Tino Reichardt <[email protected]>
Reviewed-by: Brian Atkinson <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#8491
Closes openzfs#14694
  • Loading branch information
behlendorf committed May 25, 2023
1 parent b17e472 commit edabecc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions module/os/linux/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ zfs_prune_aliases(zfsvfs_t *zfsvfs, unsigned long nr_to_scan)
int objects = 0;
int i = 0, j = 0;

zp_array = kmem_zalloc(max_array * sizeof (znode_t *), KM_SLEEP);
zp_array = vmem_zalloc(max_array * sizeof (znode_t *), KM_SLEEP);

mutex_enter(&zfsvfs->z_znodes_lock);
while ((zp = list_head(&zfsvfs->z_all_znodes)) != NULL) {
Expand Down Expand Up @@ -1228,7 +1228,7 @@ zfs_prune_aliases(zfsvfs_t *zfsvfs, unsigned long nr_to_scan)
zrele(zp);
}

kmem_free(zp_array, max_array * sizeof (znode_t *));
vmem_free(zp_array, max_array * sizeof (znode_t *));

return (objects);
}
Expand Down

0 comments on commit edabecc

Please sign in to comment.