[dm-devel] [PATCH 6/7] dm: track the maximum number of bios in a cloned request

Mike Snitzer snitzer at redhat.com
Thu Sep 12 23:09:11 UTC 2013


On Thu, Sep 12 2013 at  6:55pm -0400,
Mikulas Patocka <mpatocka at redhat.com> wrote:

> There's a race condition (it's not serious):
> 
> +               if (num_bios > ACCESS_ONCE(peak_rq_based_ios))
> +                       ACCESS_ONCE(peak_rq_based_ios) = num_bios;
> 
> You can double-check it using code like this:
> if (num_bios > ACCESS_ONCE(peak_rq_based_ios)) {
> 	spin_lock_irqsave(&peak_rq_based_ios_lock, flags);
> 	if (num_bios > peak_rq_based_ios)
> 		peak_rq_based_ios = num_bios;
> 	spin_unlock_irqrestore(&peak_rq_based_ios_lock, flags);
> }

Yeah I thought about using double checked locking but didn't want to
incur the extra locking.  Figured precise answer for peak_rq_based_ios
wasn't of utmost importance.  But I'll think about doing it.

> Maybe - reset the value peak_rq_based_ios if the user clears 
> track_peak_rq_based_ios?

Well until patch 7 there isn't a convenient place to trap the change.
And you already took issue with how I did it in that patch.




More information about the dm-devel mailing list