block: row: Idling mechanism re-factoring At the moment idling in ROW is implemented by delayed work that uses jiffies granularity which is not very accurate. This patch replaces current idling mechanism implementation with hrtime API, which gives nanosecond resolution (instead of jiffies).

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
block: row: Don't notify URGENT if there are un-completed urgent req When ROW scheduler reports to the block layer that there is an urgent request pending, the device driver may decide to stop the transmission of the current request in order to handle the urgent one. If the current transmitted request is an urgent request - we don't want it to be stopped. Due to the above ROW scheduler won't notify of an urgent request if there are urgent requests in flight.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
block: row: Update initial values of ROW data structures This patch sets the initial values of internal ROW parameters.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
[smuckle@codeaurora.org: ported from msm-3.7]
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
block: row: Re-design urgent request notification mechanism When ROW scheduler reports to the block layer that there is an urgent request pending, the device driver may decide to stop the transmission of the current request in order to handle the urgent one. This is done in order to reduce the latency of an urgent request. For example: long WRITE may be stopped to handle an urgent READ.

This patch updates the ROW URGENT notification policy to apply with the
below:

- Don't notify URGENT if there is an un-completed URGENT request in driver
- After notifying that URGENT request is present, the next request
  dispatched is the URGENT one.
- At every given moment only 1 request can be marked as URGENT.
  Independent of it's location (driver or scheduler)

Other changes to URGENT policy:
- Only READ queues are allowed to notify of an URGENT request pending.

CR fix:
If a pending urgent request (A) gets merged with another request (B)
A is removed from scheduler queue but is not removed from
rd->pending_urgent_rq.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
block: blk-core: add printk_ratelimit On failure of requests the console is flooded with prints, which result in a watchdog bark. This patch limits the number of prints to console thus, avoiding the bark.

Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
block: row: Prevent starvation of regular priority by high priority At the moment all REGULAR and LOW priority requests are starved as long as there are HIGH priority requests to dispatch. This patch prevents the above starvation by setting a starvation limit the REGULAR\LOW priority requests can tolerate.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
block: row: Update sysfs functions All ROW (time related) configurable parameters are stored in ms so there is no need to convert from/to ms when reading/updating them via sysfs.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
block: row: Fix starvation tolerance values The current starvation tolerance values increase the boot time since high priority SW requests are delayed by regular priority requests. In order to overcome this, increase the starvation tolerance values.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
block: urgent: Fix dispatching of URGENT mechanism There are cases when blk_peek_request is called not from blk_fetch_request thus the URGENT request may be started but the flag q->dispatched_urgent is not updated.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
block: drop @tsk from attempt_plug_merge() and explain sync rules attempt_plug_merge() accesses elevator without holding queue_lock and may call into ->elevator_bio_merge_fn(). The elvator is guaranteed to be valid because it's accessed iff the plugged list has requests and elevator is never exited with live requests, so as long as the elevator method can deal with unlocked access, this is safe.

Explain the sync rules around attempt_plug_merge() and drop the
unnecessary @tsk parameter.

This patch doesn't introduce any functional change.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
block: row: Fix forward ported functionalities

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
block: row: hardcode magic values.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
block: Remove "requeuing urgent req" error messages It is possible for URGENT request to be requeued/reinserted if it was fetched during the creation of a packed list. This end case is rare and is not handled at the moment. This patch changes the messages notifying of the above to debug level (instead of error) in order to clear the dmesg log.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>