mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
block: Skip I/O merges when disabled
The block I/O + elevator + I/O scheduler code spend a lot of time trying to merge I/Os -- rightfully so under "normal" circumstances. However, if one were to know that the incoming I/O stream was /very/ random in nature, the cycles are wasted. This patch adds a per-request_queue tunable that (when set) disables merge attempts (beyond the simple one-hit cache check), thus freeing up a non-trivial amount of CPU cycles. Signed-off-by: Alan D. Brunelle <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
d7e3c3249e
commit
ac9fafa124
3 changed files with 31 additions and 0 deletions
|
|
@ -135,6 +135,25 @@ static ssize_t queue_max_hw_sectors_show(struct request_queue *q, char *page)
|
|||
return queue_var_show(max_hw_sectors_kb, (page));
|
||||
}
|
||||
|
||||
static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
|
||||
{
|
||||
return queue_var_show(blk_queue_nomerges(q), page);
|
||||
}
|
||||
|
||||
static ssize_t queue_nomerges_store(struct request_queue *q, const char *page,
|
||||
size_t count)
|
||||
{
|
||||
unsigned long nm;
|
||||
ssize_t ret = queue_var_store(&nm, page, count);
|
||||
|
||||
if (nm)
|
||||
set_bit(QUEUE_FLAG_NOMERGES, &q->queue_flags);
|
||||
else
|
||||
clear_bit(QUEUE_FLAG_NOMERGES, &q->queue_flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static struct queue_sysfs_entry queue_requests_entry = {
|
||||
.attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR },
|
||||
|
|
@ -170,6 +189,12 @@ static struct queue_sysfs_entry queue_hw_sector_size_entry = {
|
|||
.show = queue_hw_sector_size_show,
|
||||
};
|
||||
|
||||
static struct queue_sysfs_entry queue_nomerges_entry = {
|
||||
.attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR },
|
||||
.show = queue_nomerges_show,
|
||||
.store = queue_nomerges_store,
|
||||
};
|
||||
|
||||
static struct attribute *default_attrs[] = {
|
||||
&queue_requests_entry.attr,
|
||||
&queue_ra_entry.attr,
|
||||
|
|
@ -177,6 +202,7 @@ static struct attribute *default_attrs[] = {
|
|||
&queue_max_sectors_entry.attr,
|
||||
&queue_iosched_entry.attr,
|
||||
&queue_hw_sector_size_entry.attr,
|
||||
&queue_nomerges_entry.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -488,6 +488,9 @@ int elv_merge(struct request_queue *q, struct request **req, struct bio *bio)
|
|||
}
|
||||
}
|
||||
|
||||
if (blk_queue_nomerges(q))
|
||||
return ELEVATOR_NO_MERGE;
|
||||
|
||||
/*
|
||||
* See if our hash lookup can find a potential backmerge.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue