Lines Matching +full:down +full:- +full:scaling
1 // SPDX-License-Identifier: GPL-2.0
3 #include "blk-rq-qos.h"
29 return atomic_inc_below(&rq_wait->inflight, limit); in rq_wait_inc_below()
35 if (rqos->ops->cleanup) in __rq_qos_cleanup()
36 rqos->ops->cleanup(rqos, bio); in __rq_qos_cleanup()
37 rqos = rqos->next; in __rq_qos_cleanup()
44 if (rqos->ops->done) in __rq_qos_done()
45 rqos->ops->done(rqos, rq); in __rq_qos_done()
46 rqos = rqos->next; in __rq_qos_done()
53 if (rqos->ops->issue) in __rq_qos_issue()
54 rqos->ops->issue(rqos, rq); in __rq_qos_issue()
55 rqos = rqos->next; in __rq_qos_issue()
62 if (rqos->ops->requeue) in __rq_qos_requeue()
63 rqos->ops->requeue(rqos, rq); in __rq_qos_requeue()
64 rqos = rqos->next; in __rq_qos_requeue()
71 if (rqos->ops->throttle) in __rq_qos_throttle()
72 rqos->ops->throttle(rqos, bio); in __rq_qos_throttle()
73 rqos = rqos->next; in __rq_qos_throttle()
80 if (rqos->ops->track) in __rq_qos_track()
81 rqos->ops->track(rqos, rq, bio); in __rq_qos_track()
82 rqos = rqos->next; in __rq_qos_track()
89 if (rqos->ops->merge) in __rq_qos_merge()
90 rqos->ops->merge(rqos, rq, bio); in __rq_qos_merge()
91 rqos = rqos->next; in __rq_qos_merge()
98 if (rqos->ops->done_bio) in __rq_qos_done_bio()
99 rqos->ops->done_bio(rqos, bio); in __rq_qos_done_bio()
100 rqos = rqos->next; in __rq_qos_done_bio()
107 if (rqos->ops->queue_depth_changed) in __rq_qos_queue_depth_changed()
108 rqos->ops->queue_depth_changed(rqos); in __rq_qos_queue_depth_changed()
109 rqos = rqos->next; in __rq_qos_queue_depth_changed()
114 * Return true, if we can't increase the depth further by scaling
126 * scaling down, then keep a setting of 1/1/1. in rq_depth_calc_max_depth()
128 if (rqd->queue_depth == 1) { in rq_depth_calc_max_depth()
129 if (rqd->scale_step > 0) in rq_depth_calc_max_depth()
130 rqd->max_depth = 1; in rq_depth_calc_max_depth()
132 rqd->max_depth = 2; in rq_depth_calc_max_depth()
143 depth = min_t(unsigned int, rqd->default_depth, in rq_depth_calc_max_depth()
144 rqd->queue_depth); in rq_depth_calc_max_depth()
145 if (rqd->scale_step > 0) in rq_depth_calc_max_depth()
146 depth = 1 + ((depth - 1) >> min(31, rqd->scale_step)); in rq_depth_calc_max_depth()
147 else if (rqd->scale_step < 0) { in rq_depth_calc_max_depth()
148 unsigned int maxd = 3 * rqd->queue_depth / 4; in rq_depth_calc_max_depth()
150 depth = 1 + ((depth - 1) << -rqd->scale_step); in rq_depth_calc_max_depth()
157 rqd->max_depth = depth; in rq_depth_calc_max_depth()
163 /* Returns true on success and false if scaling up wasn't possible */
169 if (rqd->scaled_max) in rq_depth_scale_up()
172 rqd->scale_step--; in rq_depth_scale_up()
174 rqd->scaled_max = rq_depth_calc_max_depth(rqd); in rq_depth_scale_up()
179 * Scale rwb down. If 'hard_throttle' is set, do it quicker, since we
181 * scaling down wasn't possible.
186 * Stop scaling down when we've hit the limit. This also prevents in rq_depth_scale_down()
187 * ->scale_step from going to crazy values, if the device can't in rq_depth_scale_down()
190 if (rqd->max_depth == 1) in rq_depth_scale_down()
193 if (rqd->scale_step < 0 && hard_throttle) in rq_depth_scale_down()
194 rqd->scale_step = 0; in rq_depth_scale_down()
196 rqd->scale_step++; in rq_depth_scale_down()
198 rqd->scaled_max = false; in rq_depth_scale_down()
220 * If we fail to get a budget, return -1 to interrupt the wake up loop in rq_qos_wake_function()
223 if (!data->cb(data->rqw, data->private_data)) in rq_qos_wake_function()
224 return -1; in rq_qos_wake_function()
226 data->got_token = true; in rq_qos_wake_function()
228 list_del_init(&curr->entry); in rq_qos_wake_function()
229 wake_up_process(data->task); in rq_qos_wake_function()
234 * rq_qos_wait - throttle on a rqw if we need to
237 * @acquire_inflight_cb: inc the rqw->inflight counter if we can
243 * inc the rqw->inflight if we have the ability to do so, or return false if not
265 has_sleeper = wq_has_sleeper(&rqw->wait); in rq_qos_wait()
269 has_sleeper = !prepare_to_wait_exclusive(&rqw->wait, &data.wq, in rq_qos_wait()
276 finish_wait(&rqw->wait, &data.wq); in rq_qos_wait()
292 finish_wait(&rqw->wait, &data.wq); in rq_qos_wait()
299 while (q->rq_qos) { in rq_qos_exit()
300 struct rq_qos *rqos = q->rq_qos; in rq_qos_exit()
301 q->rq_qos = rqos->next; in rq_qos_exit()
302 rqos->ops->exit(rqos); in rq_qos_exit()