Conceptually, root_iocg->hweight_donating must be less than WEIGHT_ONE but
all hweight calculations round up and thus it may end up >= WEIGHT_ONE
triggering divide-by-zero and other issues. Bound the value to avoid
surprises.
Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: e08d02aa5fc9 ("blk-iocost: implement Andy's method for donation weight updates")
---
block/blk-iocost.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
Conceptually, root_iocg->hweight_donating must be less than WEIGHT_ONE but
all hweight calculations round up and thus it may end up >= WEIGHT_ONE
triggering divide-by-zero and other issues. Bound the value to avoid
surprises.
Conceptually, root_iocg->hweight_donating must be less than WEIGHT_ONE but
all hweight calculations round up and thus it may end up >= WEIGHT_ONE
triggering divide-by-zero and other issues. Bound the value to avoid
surprises.
Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: e08d02aa5fc9 ("blk-iocost: implement Andy's method for donation weight updates")
Signed-off-by: Tejun Heo <tj@kernel.org>
---
Jens, I was flipping between doing max_t(, 1) over the whole divider and
doing min_t(, WEIGHT_ONE - 1) for hweight_donating. I thought that I as
testing after the last change but it obviously wasn't and the previous patch
doesn't compile due to missing type argument. Can you please apply this
patch instead? I can send an incremental patch if that'd be better. My
apologies.
Thanks.
block/blk-iocost.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
Conceptually, root_iocg->hweight_donating must be less than WEIGHT_ONE but
all hweight calculations round up and thus it may end up >= WEIGHT_ONE
triggering divide-by-zero and other issues. Bound the value to avoid
surprises.
Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: e08d02aa5fc9 ("blk-iocost: implement Andy's method for donation weight updates")
Signed-off-by: Tejun Heo <tj@kernel.org>
---
Jens, I was flipping between doing max_t(, 1) over the whole divider and
doing min_t(, WEIGHT_ONE - 1) for hweight_donating. I thought that I as
testing after the last change but it obviously wasn't and the previous patch
doesn't compile due to missing type argument. Can you please apply this
patch instead? I can send an incremental patch if that'd be better. My
apologies.
Sure, I replaced it. BTW, you had two signed-off-by's in there.
--
Jens Axboe
On Fri, Sep 11, 2020 at 04:43:18PM -0600, Jens Axboe wrote:
On 9/11/20 4:40 PM, Tejun Heo wrote:
quoted
Conceptually, root_iocg->hweight_donating must be less than WEIGHT_ONE but
all hweight calculations round up and thus it may end up >= WEIGHT_ONE
triggering divide-by-zero and other issues. Bound the value to avoid
surprises.
Signed-off-by: Tejun Heo <redacted>
Fixes: e08d02aa5fc9 ("blk-iocost: implement Andy's method for donation weight updates")
Signed-off-by: Tejun Heo <redacted>
---
Jens, I was flipping between doing max_t(, 1) over the whole divider and
doing min_t(, WEIGHT_ONE - 1) for hweight_donating. I thought that I as
testing after the last change but it obviously wasn't and the previous patch
doesn't compile due to missing type argument. Can you please apply this
patch instead? I can send an incremental patch if that'd be better. My
apologies.
Sure, I replaced it. BTW, you had two signed-off-by's in there.
Yeah, sloppy all around. Sorry about that. Gotta slow down more when posting
oh-shit-I-fucked-up stuff.
Thanks.
--
tejun