diff options
| author | Tejun Heo <tj@kernel.org> | 2012-03-19 18:10:58 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2012-03-20 07:47:47 -0400 |
| commit | 598971bfbdfdc8701337dc1636c7919c44699914 (patch) | |
| tree | 3de33d5059ce3a0cf77a9735804335f9264b7c08 /include/linux | |
| parent | abede6da27d9bd62ea9512830c83e32b3ee1104c (diff) | |
cfq: don't use icq_get_changed()
cfq caches the associated cfqq's for a given cic. The cache needs to
be flushed if the cic's ioprio or blkcg has changed. It is currently
done by requiring the changing action to set the respective
ICQ_*_CHANGED bit in the icq and testing it from cfq_set_request(),
which involves iterating through all the affected icqs.
All cfq wants to know is whether ioprio and/or blkcg have changed
since the last flush and can be easily achieved by just remembering
the current ioprio and blkcg ID in cic.
This patch adds cic->{ioprio|blkcg_id}, updates all ioprio users to
use the remembered value instead, and updates cfq_set_request() path
such that, instead of using icq_get_changed(), the current values are
compared against the remembered ones and trigger appropriate flush
action if not. Condition tests are moved inside both _changed
functions which are now named check_ioprio_changed() and
check_blkcg_changed().
ioprio.h::task_ioprio*() can't be used anymore and replaced with
open-coded IOPRIO_CLASS_NONE case in cfq_async_queue_prio().
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/ioprio.h | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h index 76dad480884..beb9ce1c2c2 100644 --- a/include/linux/ioprio.h +++ b/include/linux/ioprio.h | |||
| @@ -42,26 +42,14 @@ enum { | |||
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | /* | 44 | /* |
| 45 | * if process has set io priority explicitly, use that. if not, convert | 45 | * Fallback BE priority |
| 46 | * the cpu scheduler nice value to an io priority | ||
| 47 | */ | 46 | */ |
| 48 | #define IOPRIO_NORM (4) | 47 | #define IOPRIO_NORM (4) |
| 49 | static inline int task_ioprio(struct io_context *ioc) | ||
| 50 | { | ||
| 51 | if (ioprio_valid(ioc->ioprio)) | ||
| 52 | return IOPRIO_PRIO_DATA(ioc->ioprio); | ||
| 53 | |||
| 54 | return IOPRIO_NORM; | ||
| 55 | } | ||
| 56 | |||
| 57 | static inline int task_ioprio_class(struct io_context *ioc) | ||
| 58 | { | ||
| 59 | if (ioprio_valid(ioc->ioprio)) | ||
| 60 | return IOPRIO_PRIO_CLASS(ioc->ioprio); | ||
| 61 | |||
| 62 | return IOPRIO_CLASS_BE; | ||
| 63 | } | ||
| 64 | 48 | ||
| 49 | /* | ||
| 50 | * if process has set io priority explicitly, use that. if not, convert | ||
| 51 | * the cpu scheduler nice value to an io priority | ||
| 52 | */ | ||
| 65 | static inline int task_nice_ioprio(struct task_struct *task) | 53 | static inline int task_nice_ioprio(struct task_struct *task) |
| 66 | { | 54 | { |
| 67 | return (task_nice(task) + 20) / 5; | 55 | return (task_nice(task) + 20) / 5; |
