diff mbox series

[RFC,2/3] lib/sbitmap: don't export sbitmap_get_shallow()

Message ID 20241209115522.3741093-3-yukuai1@huaweicloud.com (mailing list archive)
State New
Headers show
Series lib/sbitmap: fix shallow_depth tag allocation | expand

Commit Message

Yu Kuai Dec. 9, 2024, 11:55 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com>

Because it's only used inside sbitmap.c.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/kyber-iosched.c   |  2 +-
 include/linux/sbitmap.h | 17 -----------------
 lib/sbitmap.c           |  3 +--
 3 files changed, 2 insertions(+), 20 deletions(-)

Comments

Bart Van Assche Dec. 9, 2024, 6:05 p.m. UTC | #1
On 12/9/24 7:55 PM, Yu Kuai wrote:
> -/**
> - * sbitmap_get_shallow() - Try to allocate a free bit from a &struct sbitmap,
> - * limiting the depth used from each word.
> - * @sb: Bitmap to allocate from.
> - * @shallow_depth: The maximum number of bits to allocate from a single word.
> - *
> - * This rather specific operation allows for having multiple users with
> - * different allocation limits. E.g., there can be a high-priority class that
> - * uses sbitmap_get() and a low-priority class that uses sbitmap_get_shallow()
> - * with a @shallow_depth of (1 << (@sb->shift - 1)). Then, the low-priority
> - * class can only allocate half of the total bits in the bitmap, preventing it
> - * from starving out the high-priority class.
> - *
> - * Return: Non-negative allocated bit number if successful, -1 otherwise.
> - */
> -int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth);

Please retain the above comment block by moving it into lib/sbitmap.c.

Thanks,

Bart.
Yu Kuai Dec. 10, 2024, 2:54 a.m. UTC | #2
Hi,

在 2024/12/10 2:05, Bart Van Assche 写道:
> On 12/9/24 7:55 PM, Yu Kuai wrote:
>> -/**
>> - * sbitmap_get_shallow() - Try to allocate a free bit from a &struct 
>> sbitmap,
>> - * limiting the depth used from each word.
>> - * @sb: Bitmap to allocate from.
>> - * @shallow_depth: The maximum number of bits to allocate from a 
>> single word.
>> - *
>> - * This rather specific operation allows for having multiple users with
>> - * different allocation limits. E.g., there can be a high-priority 
>> class that
>> - * uses sbitmap_get() and a low-priority class that uses 
>> sbitmap_get_shallow()
>> - * with a @shallow_depth of (1 << (@sb->shift - 1)). Then, the 
>> low-priority
>> - * class can only allocate half of the total bits in the bitmap, 
>> preventing it
>> - * from starving out the high-priority class.
>> - *
>> - * Return: Non-negative allocated bit number if successful, -1 
>> otherwise.
>> - */
>> -int sbitmap_get_shallow(struct sbitmap *sb, unsigned long 
>> shallow_depth);
> 
> Please retain the above comment block by moving it into lib/sbitmap.c.
> 

Since the comment must be updated after patch 3, I'll apply the last
patch and update comment first, and do this cleanup at last.

Thanks,
Kuai

> Thanks,
> 
> Bart.
> .
>
diff mbox series

Patch

diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c
index 4155594aefc6..2cb579b288e1 100644
--- a/block/kyber-iosched.c
+++ b/block/kyber-iosched.c
@@ -159,7 +159,7 @@  struct kyber_queue_data {
 
 	/*
 	 * Async request percentage, converted to per-word depth for
-	 * sbitmap_get_shallow().
+	 * sbitmap_queue_get_shallow().
 	 */
 	unsigned int async_depth;
 
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
index 189140bf11fc..e1730f5fdf9c 100644
--- a/include/linux/sbitmap.h
+++ b/include/linux/sbitmap.h
@@ -209,23 +209,6 @@  void sbitmap_resize(struct sbitmap *sb, unsigned int depth);
  */
 int sbitmap_get(struct sbitmap *sb);
 
-/**
- * sbitmap_get_shallow() - Try to allocate a free bit from a &struct sbitmap,
- * limiting the depth used from each word.
- * @sb: Bitmap to allocate from.
- * @shallow_depth: The maximum number of bits to allocate from a single word.
- *
- * This rather specific operation allows for having multiple users with
- * different allocation limits. E.g., there can be a high-priority class that
- * uses sbitmap_get() and a low-priority class that uses sbitmap_get_shallow()
- * with a @shallow_depth of (1 << (@sb->shift - 1)). Then, the low-priority
- * class can only allocate half of the total bits in the bitmap, preventing it
- * from starving out the high-priority class.
- *
- * Return: Non-negative allocated bit number if successful, -1 otherwise.
- */
-int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth);
-
 /**
  * sbitmap_any_bit_set() - Check for a set bit in a &struct sbitmap.
  * @sb: Bitmap to check.
diff --git a/lib/sbitmap.c b/lib/sbitmap.c
index d3412984170c..9d4213ce7916 100644
--- a/lib/sbitmap.c
+++ b/lib/sbitmap.c
@@ -287,7 +287,7 @@  static int __sbitmap_get_shallow(struct sbitmap *sb,
 	return sbitmap_find_bit(sb, shallow_depth, index, alloc_hint, true);
 }
 
-int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth)
+static int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth)
 {
 	int nr;
 	unsigned int hint, depth;
@@ -302,7 +302,6 @@  int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth)
 
 	return nr;
 }
-EXPORT_SYMBOL_GPL(sbitmap_get_shallow);
 
 bool sbitmap_any_bit_set(const struct sbitmap *sb)
 {