Lines Matching +full:down +full:- +full:scaling
1 // SPDX-License-Identifier: GPL-2.0
3 #include "blk-rq-qos.h"
23 return atomic_inc_below(&rq_wait->inflight, limit); in rq_wait_inc_below()
29 if (rqos->ops->cleanup) in __rq_qos_cleanup()
30 rqos->ops->cleanup(rqos, bio); in __rq_qos_cleanup()
31 rqos = rqos->next; in __rq_qos_cleanup()
38 if (rqos->ops->done) in __rq_qos_done()
39 rqos->ops->done(rqos, rq); in __rq_qos_done()
40 rqos = rqos->next; in __rq_qos_done()
47 if (rqos->ops->issue) in __rq_qos_issue()
48 rqos->ops->issue(rqos, rq); in __rq_qos_issue()
49 rqos = rqos->next; in __rq_qos_issue()
56 if (rqos->ops->requeue) in __rq_qos_requeue()
57 rqos->ops->requeue(rqos, rq); in __rq_qos_requeue()
58 rqos = rqos->next; in __rq_qos_requeue()
65 if (rqos->ops->throttle) in __rq_qos_throttle()
66 rqos->ops->throttle(rqos, bio); in __rq_qos_throttle()
67 rqos = rqos->next; in __rq_qos_throttle()
74 if (rqos->ops->track) in __rq_qos_track()
75 rqos->ops->track(rqos, rq, bio); in __rq_qos_track()
76 rqos = rqos->next; in __rq_qos_track()
83 if (rqos->ops->merge) in __rq_qos_merge()
84 rqos->ops->merge(rqos, rq, bio); in __rq_qos_merge()
85 rqos = rqos->next; in __rq_qos_merge()
92 if (rqos->ops->done_bio) in __rq_qos_done_bio()
93 rqos->ops->done_bio(rqos, bio); in __rq_qos_done_bio()
94 rqos = rqos->next; in __rq_qos_done_bio()
101 if (rqos->ops->queue_depth_changed) in __rq_qos_queue_depth_changed()
102 rqos->ops->queue_depth_changed(rqos); in __rq_qos_queue_depth_changed()
103 rqos = rqos->next; in __rq_qos_queue_depth_changed()
108 * Return true, if we can't increase the depth further by scaling
120 * scaling down, then keep a setting of 1/1/1. in rq_depth_calc_max_depth()
122 if (rqd->queue_depth == 1) { in rq_depth_calc_max_depth()
123 if (rqd->scale_step > 0) in rq_depth_calc_max_depth()
124 rqd->max_depth = 1; in rq_depth_calc_max_depth()
126 rqd->max_depth = 2; in rq_depth_calc_max_depth()
137 depth = min_t(unsigned int, rqd->default_depth, in rq_depth_calc_max_depth()
138 rqd->queue_depth); in rq_depth_calc_max_depth()
139 if (rqd->scale_step > 0) in rq_depth_calc_max_depth()
140 depth = 1 + ((depth - 1) >> min(31, rqd->scale_step)); in rq_depth_calc_max_depth()
141 else if (rqd->scale_step < 0) { in rq_depth_calc_max_depth()
142 unsigned int maxd = 3 * rqd->queue_depth / 4; in rq_depth_calc_max_depth()
144 depth = 1 + ((depth - 1) << -rqd->scale_step); in rq_depth_calc_max_depth()
151 rqd->max_depth = depth; in rq_depth_calc_max_depth()
157 /* Returns true on success and false if scaling up wasn't possible */
163 if (rqd->scaled_max) in rq_depth_scale_up()
166 rqd->scale_step--; in rq_depth_scale_up()
168 rqd->scaled_max = rq_depth_calc_max_depth(rqd); in rq_depth_scale_up()
173 * Scale rwb down. If 'hard_throttle' is set, do it quicker, since we
175 * scaling down wasn't possible.
180 * Stop scaling down when we've hit the limit. This also prevents in rq_depth_scale_down()
181 * ->scale_step from going to crazy values, if the device can't in rq_depth_scale_down()
184 if (rqd->max_depth == 1) in rq_depth_scale_down()
187 if (rqd->scale_step < 0 && hard_throttle) in rq_depth_scale_down()
188 rqd->scale_step = 0; in rq_depth_scale_down()
190 rqd->scale_step++; in rq_depth_scale_down()
192 rqd->scaled_max = false; in rq_depth_scale_down()
214 * If we fail to get a budget, return -1 to interrupt the wake up loop in rq_qos_wake_function()
217 if (!data->cb(data->rqw, data->private_data)) in rq_qos_wake_function()
218 return -1; in rq_qos_wake_function()
220 data->got_token = true; in rq_qos_wake_function()
222 list_del_init(&curr->entry); in rq_qos_wake_function()
223 wake_up_process(data->task); in rq_qos_wake_function()
228 * rq_qos_wait - throttle on a rqw if we need to
231 * @acquire_inflight_cb: inc the rqw->inflight counter if we can
237 * inc the rqw->inflight if we have the ability to do so, or return false if not
259 has_sleeper = wq_has_sleeper(&rqw->wait); in rq_qos_wait()
263 has_sleeper = !prepare_to_wait_exclusive(&rqw->wait, &data.wq, in rq_qos_wait()
270 finish_wait(&rqw->wait, &data.wq); in rq_qos_wait()
286 finish_wait(&rqw->wait, &data.wq); in rq_qos_wait()
291 while (q->rq_qos) { in rq_qos_exit()
292 struct rq_qos *rqos = q->rq_qos; in rq_qos_exit()
293 q->rq_qos = rqos->next; in rq_qos_exit()
294 rqos->ops->exit(rqos); in rq_qos_exit()