mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 02:21:16 +00:00
ac922cd71c
Add the BFQ-v7r8 I/O scheduler to 3.10.8+. The general structure is borrowed from CFQ, as much of the code for handling I/O contexts Over time, several useful features have been ported from CFQ as well (details in the changelog in README.BFQ). A (bfq_)queue is associated to each task doing I/O on a device, and each time a scheduling decision has to be made a queue is selected and served until it expires. - Slices are given in the service domain: tasks are assigned budgets, measured in number of sectors. Once got the disk, a task must however consume its assigned budget within a configurable maximum time (by default, the maximum possible value of the budgets is automatically computed to comply with this timeout). This allows the desired latency vs "throughput boosting" tradeoff to be set. - Budgets are scheduled according to a variant of WF2Q+, implemented using an augmented rb-tree to take eligibility into account while preserving an O(log N) overall complexity. - A low-latency tunable is provided; if enabled, both interactive and soft real-time applications are guaranteed a very low latency. - Latency guarantees are preserved also in the presence of NCQ. - Also with flash-based devices, a high throughput is achieved while still preserving latency guarantees. - BFQ features Early Queue Merge (EQM), a sort of fusion of the cooperating-queue-merging and the preemption mechanisms present in CFQ. EQM is in fact a unified mechanism that tries to get a sequential read pattern, and hence a high throughput, with any set of processes performing interleaved I/O over a contiguous sequence of sectors. - BFQ supports full hierarchical scheduling, exporting a cgroups interface. Since each node has a full scheduler, each group can be assigned its own weight. - If the cgroups interface is not used, only I/O priorities can be assigned to processes, with ioprio values mapped to weights with the relation weight = IOPRIO_BE_NR - ioprio. - ioprio classes are served in strict priority order, i.e., lower priority queues are not served as long as there are higher priority queues. Among queues in the same class the bandwidth is distributed in proportion to the weight of each queue. A very thin extra bandwidth is however guaranteed to the Idle class, to prevent it from starving. Change-Id: Iebf9be399041b89d79b54077da1a34a81d4e4238 Signed-off-by: Paolo Valente <paolo.valente@unimore.it> Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
36 lines
963 B
C
36 lines
963 B
C
/*
|
|
* BFQ: I/O context handling.
|
|
*
|
|
* Based on ideas and code from CFQ:
|
|
* Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
|
|
*
|
|
* Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>
|
|
* Paolo Valente <paolo.valente@unimore.it>
|
|
*
|
|
* Copyright (C) 2010 Paolo Valente <paolo.valente@unimore.it>
|
|
*/
|
|
|
|
/**
|
|
* icq_to_bic - convert iocontext queue structure to bfq_io_cq.
|
|
* @icq: the iocontext queue.
|
|
*/
|
|
static inline struct bfq_io_cq *icq_to_bic(struct io_cq *icq)
|
|
{
|
|
/* bic->icq is the first member, %NULL will convert to %NULL */
|
|
return container_of(icq, struct bfq_io_cq, icq);
|
|
}
|
|
|
|
/**
|
|
* bfq_bic_lookup - search into @ioc a bic associated to @bfqd.
|
|
* @bfqd: the lookup key.
|
|
* @ioc: the io_context of the process doing I/O.
|
|
*
|
|
* Queue lock must be held.
|
|
*/
|
|
static inline struct bfq_io_cq *bfq_bic_lookup(struct bfq_data *bfqd,
|
|
struct io_context *ioc)
|
|
{
|
|
if (ioc)
|
|
return icq_to_bic(ioc_lookup_icq(ioc, bfqd->queue));
|
|
return NULL;
|
|
}
|