From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
Moshe Shemesh <moshe@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next 01/14] lib: bitmap: Introduce node-aware alloc API
Date: Tue, 26 Oct 2021 19:33:34 -0700 [thread overview]
Message-ID: <20211027023347.699076-2-saeed@kernel.org> (raw)
In-Reply-To: <20211027023347.699076-1-saeed@kernel.org>
From: Tariq Toukan <tariqt@nvidia.com>
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>
---
include/linux/bitmap.h | 2 ++
lib/bitmap.c | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 37f36dad18bd..a241dcf50f39 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -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. */
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 663dd81967d4..926408883456 100644
--- a/lib/bitmap.c
+++ b/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);
--
2.31.1
next prev parent reply other threads:[~2021-10-27 2:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 2:33 [pull request][net-next 00/14] mlx5 HW GRO 2021-10-26 Saeed Mahameed
2021-10-27 2:33 ` Saeed Mahameed [this message]
2021-10-27 13:50 ` [net-next 01/14] lib: bitmap: Introduce node-aware alloc API patchwork-bot+netdevbpf
2021-10-27 2:33 ` [net-next 02/14] net: Prevent HW-GRO and LRO features operate together Saeed Mahameed
2021-10-27 2:33 ` [net-next 03/14] net/mlx5e: Rename lro_timeout to packet_merge_timeout Saeed Mahameed
2021-10-27 2:33 ` [net-next 04/14] net/mlx5: Add SHAMPO caps, HW bits and enumerations Saeed Mahameed
2021-10-27 2:33 ` [net-next 05/14] net/mlx5e: Rename TIR lro functions to TIR packet merge functions Saeed Mahameed
2021-10-27 2:33 ` [net-next 06/14] net/mlx5e: Add support to klm_umr_wqe Saeed Mahameed
2021-10-27 2:33 ` [net-next 07/14] net/mlx5e: Add control path for SHAMPO feature Saeed Mahameed
2021-10-27 2:33 ` [net-next 08/14] net/mlx5e: Add handle SHAMPO cqe support Saeed Mahameed
2021-10-27 2:33 ` [net-next 09/14] net/mlx5e: Add data path for SHAMPO feature Saeed Mahameed
2021-10-27 2:33 ` [net-next 10/14] net/mlx5e: HW_GRO cqe handler implementation Saeed Mahameed
2021-10-27 2:33 ` [net-next 11/14] net/mlx5e: Add HW_GRO statistics Saeed Mahameed
2021-10-27 2:33 ` [net-next 12/14] net/mlx5e: Add HW-GRO offload Saeed Mahameed
2021-10-27 2:33 ` [net-next 13/14] net/mlx5e: Prevent HW-GRO and CQE-COMPRESS features operate together Saeed Mahameed
2021-10-27 2:33 ` [net-next 14/14] net/mlx5: Lag, Make mlx5_lag_is_multipath() be static inline Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211027023347.699076-2-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).