Re: [PATCH 6/9] sbitmap: warn if using smaller shallow depth than was setup

2018-05-10 Thread Jens Axboe
On 5/10/18 11:02 AM, Omar Sandoval wrote:
> On Thu, May 10, 2018 at 10:24:24AM -0600, Jens Axboe wrote:
>> From: Omar Sandoval 
>>
>> Make sure the user passed the right value to
>> sbitmap_queue_min_shallow_depth().
> 
> An unlucky bisect that lands between this change and the BFQ/Kyber
> changes is going to trigger this warning. We should have it after the
> BFQ/Kyber changes.

Good point, I'll move it after the kyber/bfq change.

-- 
Jens Axboe



Re: [PATCH 6/9] sbitmap: warn if using smaller shallow depth than was setup

2018-05-10 Thread Omar Sandoval
On Thu, May 10, 2018 at 10:24:24AM -0600, Jens Axboe wrote:
> From: Omar Sandoval 
> 
> Make sure the user passed the right value to
> sbitmap_queue_min_shallow_depth().

An unlucky bisect that lands between this change and the BFQ/Kyber
changes is going to trigger this warning. We should have it after the
BFQ/Kyber changes.

> Acked-by: Paolo Valente 
> Signed-off-by: Omar Sandoval 
> Signed-off-by: Jens Axboe 
> ---
>  lib/sbitmap.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/sbitmap.c b/lib/sbitmap.c
> index d21473b42465..8f0950fbaa5c 100644
> --- a/lib/sbitmap.c
> +++ b/lib/sbitmap.c
> @@ -402,6 +402,8 @@ int __sbitmap_queue_get_shallow(struct sbitmap_queue *sbq,
>   unsigned int hint, depth;
>   int nr;
>  
> + WARN_ON_ONCE(shallow_depth < sbq->min_shallow_depth);
> +
>   hint = this_cpu_read(*sbq->alloc_hint);
>   depth = READ_ONCE(sbq->sb.depth);
>   if (unlikely(hint >= depth)) {
> -- 
> 2.7.4
> 


[PATCH 6/9] sbitmap: warn if using smaller shallow depth than was setup

2018-05-10 Thread Jens Axboe
From: Omar Sandoval 

Make sure the user passed the right value to
sbitmap_queue_min_shallow_depth().

Acked-by: Paolo Valente 
Signed-off-by: Omar Sandoval 
Signed-off-by: Jens Axboe 
---
 lib/sbitmap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/sbitmap.c b/lib/sbitmap.c
index d21473b42465..8f0950fbaa5c 100644
--- a/lib/sbitmap.c
+++ b/lib/sbitmap.c
@@ -402,6 +402,8 @@ int __sbitmap_queue_get_shallow(struct sbitmap_queue *sbq,
unsigned int hint, depth;
int nr;
 
+   WARN_ON_ONCE(shallow_depth < sbq->min_shallow_depth);
+
hint = this_cpu_read(*sbq->alloc_hint);
depth = READ_ONCE(sbq->sb.depth);
if (unlikely(hint >= depth)) {
-- 
2.7.4