mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable.git
synced 2025-09-27 17:32:00 +10:00
lib: bitmap: Introduce node-aware alloc API
[ Upstream commit7529cc7fbd
] Expose new node-aware API for bitmap allocation: bitmap_alloc_node() / bitmap_zalloc_node(). Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Moshe Shemesh <moshe@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Stable-dep-of:531d0d32de
("net/mlx5: Correctly set gso_size when LRO is used") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ce2f1b5d0f
commit
9737501f26
@ -123,6 +123,8 @@ struct device;
|
||||
*/
|
||||
unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags);
|
||||
unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags);
|
||||
unsigned long *bitmap_alloc_node(unsigned int nbits, gfp_t flags, int node);
|
||||
unsigned long *bitmap_zalloc_node(unsigned int nbits, gfp_t flags, int node);
|
||||
void bitmap_free(const unsigned long *bitmap);
|
||||
|
||||
/* Managed variants of the above. */
|
||||
|
13
lib/bitmap.c
13
lib/bitmap.c
@ -1398,6 +1398,19 @@ unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags)
|
||||
}
|
||||
EXPORT_SYMBOL(bitmap_zalloc);
|
||||
|
||||
unsigned long *bitmap_alloc_node(unsigned int nbits, gfp_t flags, int node)
|
||||
{
|
||||
return kmalloc_array_node(BITS_TO_LONGS(nbits), sizeof(unsigned long),
|
||||
flags, node);
|
||||
}
|
||||
EXPORT_SYMBOL(bitmap_alloc_node);
|
||||
|
||||
unsigned long *bitmap_zalloc_node(unsigned int nbits, gfp_t flags, int node)
|
||||
{
|
||||
return bitmap_alloc_node(nbits, flags | __GFP_ZERO, node);
|
||||
}
|
||||
EXPORT_SYMBOL(bitmap_zalloc_node);
|
||||
|
||||
void bitmap_free(const unsigned long *bitmap)
|
||||
{
|
||||
kfree(bitmap);
|
||||
|
Loading…
Reference in New Issue
Block a user