2009-02-02 20:02:31 +08:00
|
|
|
Queue sysfs files
|
|
|
|
=================
|
|
|
|
|
|
|
|
This text file will detail the queue files that are located in the sysfs tree
|
|
|
|
for each block device. Note that stacked devices typically do not export
|
|
|
|
any settings, since their queue merely functions are a remapping target.
|
|
|
|
These files are the ones found in the /sys/block/xxx/queue/ directory.
|
|
|
|
|
|
|
|
Files denoted with a RO postfix are readonly and the RW postfix means
|
|
|
|
read-write.
|
|
|
|
|
2012-08-09 21:28:05 +08:00
|
|
|
add_random (RW)
|
|
|
|
----------------
|
2014-08-26 18:33:20 +08:00
|
|
|
This file allows to turn off the disk entropy contribution. Default
|
2012-08-09 21:28:05 +08:00
|
|
|
value of this file is '1'(on).
|
|
|
|
|
|
|
|
discard_granularity (RO)
|
|
|
|
-----------------------
|
|
|
|
This shows the size of internal allocation of the device in bytes, if
|
|
|
|
reported by the device. A value of '0' means device does not support
|
|
|
|
the discard functionality.
|
|
|
|
|
2015-07-16 23:14:26 +08:00
|
|
|
discard_max_hw_bytes (RO)
|
2012-08-09 21:28:05 +08:00
|
|
|
----------------------
|
|
|
|
Devices that support discard functionality may have internal limits on
|
|
|
|
the number of bytes that can be trimmed or unmapped in a single operation.
|
|
|
|
The discard_max_bytes parameter is set by the device driver to the maximum
|
|
|
|
number of bytes that can be discarded in a single operation. Discard
|
|
|
|
requests issued to the device must not exceed this limit. A discard_max_bytes
|
|
|
|
value of 0 means that the device does not support discard functionality.
|
|
|
|
|
2015-07-16 23:14:26 +08:00
|
|
|
discard_max_bytes (RW)
|
|
|
|
----------------------
|
|
|
|
While discard_max_hw_bytes is the hardware limit for the device, this
|
|
|
|
setting is the software limit. Some devices exhibit large latencies when
|
|
|
|
large discards are issued, setting this value lower will make Linux issue
|
|
|
|
smaller discards and potentially help reduce latencies induced by large
|
|
|
|
discard operations.
|
|
|
|
|
2012-08-09 21:28:05 +08:00
|
|
|
discard_zeroes_data (RO)
|
|
|
|
------------------------
|
|
|
|
When read, this file will show if the discarded block are zeroed by the
|
|
|
|
device or not. If its value is '1' the blocks are zeroed otherwise not.
|
|
|
|
|
2009-02-02 20:02:31 +08:00
|
|
|
hw_sector_size (RO)
|
|
|
|
-------------------
|
|
|
|
This is the hardware sector size of the device, in bytes.
|
|
|
|
|
2012-08-09 21:28:05 +08:00
|
|
|
iostats (RW)
|
|
|
|
-------------
|
|
|
|
This file is used to control (on/off) the iostats accounting of the
|
|
|
|
disk.
|
|
|
|
|
|
|
|
logical_block_size (RO)
|
|
|
|
-----------------------
|
2016-06-29 04:10:57 +08:00
|
|
|
This is the logical block size of the device, in bytes.
|
2012-08-09 21:28:05 +08:00
|
|
|
|
2009-02-02 20:02:31 +08:00
|
|
|
max_hw_sectors_kb (RO)
|
|
|
|
----------------------
|
|
|
|
This is the maximum number of kilobytes supported in a single data transfer.
|
|
|
|
|
2012-08-09 21:28:05 +08:00
|
|
|
max_integrity_segments (RO)
|
|
|
|
---------------------------
|
|
|
|
When read, this file shows the max limit of integrity segments as
|
|
|
|
set by block layer which a hardware controller can handle.
|
|
|
|
|
2009-02-02 20:02:31 +08:00
|
|
|
max_sectors_kb (RW)
|
|
|
|
-------------------
|
|
|
|
This is the maximum number of kilobytes that the block layer will allow
|
|
|
|
for a filesystem request. Must be smaller than or equal to the maximum
|
|
|
|
size allowed by the hardware.
|
|
|
|
|
2012-08-09 21:28:05 +08:00
|
|
|
max_segments (RO)
|
|
|
|
-----------------
|
|
|
|
Maximum number of segments of the device.
|
|
|
|
|
|
|
|
max_segment_size (RO)
|
|
|
|
---------------------
|
|
|
|
Maximum segment size of the device.
|
|
|
|
|
|
|
|
minimum_io_size (RO)
|
|
|
|
--------------------
|
2014-08-26 18:33:20 +08:00
|
|
|
This is the smallest preferred IO size reported by the device.
|
2012-08-09 21:28:05 +08:00
|
|
|
|
2009-02-02 20:02:31 +08:00
|
|
|
nomerges (RW)
|
|
|
|
-------------
|
2010-01-29 16:04:08 +08:00
|
|
|
This enables the user to disable the lookup logic involved with IO
|
|
|
|
merging requests in the block layer. By default (0) all merges are
|
|
|
|
enabled. When set to 1 only simple one-hit merges will be tried. When
|
|
|
|
set to 2 no merge algorithms will be tried (including one-hit or more
|
|
|
|
complex tree/hash lookups).
|
2009-02-02 20:02:31 +08:00
|
|
|
|
|
|
|
nr_requests (RW)
|
|
|
|
----------------
|
|
|
|
This controls how many requests may be allocated in the block layer for
|
|
|
|
read or write requests. Note that the total allocated number may be twice
|
|
|
|
this amount, since it applies only to reads or writes (not the accumulated
|
|
|
|
sum).
|
|
|
|
|
blkcg: implement per-blkg request allocation
Currently, request_queue has one request_list to allocate requests
from regardless of blkcg of the IO being issued. When the unified
request pool is used up, cfq proportional IO limits become meaningless
- whoever grabs the next request being freed wins the race regardless
of the configured weights.
This can be easily demonstrated by creating a blkio cgroup w/ very low
weight, put a program which can issue a lot of random direct IOs there
and running a sequential IO from a different cgroup. As soon as the
request pool is used up, the sequential IO bandwidth crashes.
This patch implements per-blkg request_list. Each blkg has its own
request_list and any IO allocates its request from the matching blkg
making blkcgs completely isolated in terms of request allocation.
* Root blkcg uses the request_list embedded in each request_queue,
which was renamed to @q->root_rl from @q->rq. While making blkcg rl
handling a bit harier, this enables avoiding most overhead for root
blkcg.
* Queue fullness is properly per request_list but bdi isn't blkcg
aware yet, so congestion state currently just follows the root
blkcg. As writeback isn't aware of blkcg yet, this works okay for
async congestion but readahead may get the wrong signals. It's
better than blkcg completely collapsing with shared request_list but
needs to be improved with future changes.
* After this change, each block cgroup gets a full request pool making
resource consumption of each cgroup higher. This makes allowing
non-root users to create cgroups less desirable; however, note that
allowing non-root users to directly manage cgroups is already
severely broken regardless of this patch - each block cgroup
consumes kernel memory and skews IO weight (IO weights are not
hierarchical).
v2: queue-sysfs.txt updated and patch description udpated as suggested
by Vivek.
v3: blk_get_rl() wasn't checking error return from
blkg_lookup_create() and may cause oops on lookup failure. Fix it
by falling back to root_rl on blkg lookup failures. This problem
was spotted by Rakesh Iyer <rni@google.com>.
v4: Updated to accomodate 458f27a982 "block: Avoid missed wakeup in
request waitqueue". blk_drain_queue() now wakes up waiters on all
blkg->rl on the target queue.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2012-06-27 06:05:44 +08:00
|
|
|
To avoid priority inversion through request starvation, a request
|
|
|
|
queue maintains a separate request pool per each cgroup when
|
|
|
|
CONFIG_BLK_CGROUP is enabled, and this parameter applies to each such
|
|
|
|
per-block-cgroup request pool. IOW, if there are N block cgroups,
|
2013-05-09 07:56:16 +08:00
|
|
|
each request queue may have up to N request pools, each independently
|
blkcg: implement per-blkg request allocation
Currently, request_queue has one request_list to allocate requests
from regardless of blkcg of the IO being issued. When the unified
request pool is used up, cfq proportional IO limits become meaningless
- whoever grabs the next request being freed wins the race regardless
of the configured weights.
This can be easily demonstrated by creating a blkio cgroup w/ very low
weight, put a program which can issue a lot of random direct IOs there
and running a sequential IO from a different cgroup. As soon as the
request pool is used up, the sequential IO bandwidth crashes.
This patch implements per-blkg request_list. Each blkg has its own
request_list and any IO allocates its request from the matching blkg
making blkcgs completely isolated in terms of request allocation.
* Root blkcg uses the request_list embedded in each request_queue,
which was renamed to @q->root_rl from @q->rq. While making blkcg rl
handling a bit harier, this enables avoiding most overhead for root
blkcg.
* Queue fullness is properly per request_list but bdi isn't blkcg
aware yet, so congestion state currently just follows the root
blkcg. As writeback isn't aware of blkcg yet, this works okay for
async congestion but readahead may get the wrong signals. It's
better than blkcg completely collapsing with shared request_list but
needs to be improved with future changes.
* After this change, each block cgroup gets a full request pool making
resource consumption of each cgroup higher. This makes allowing
non-root users to create cgroups less desirable; however, note that
allowing non-root users to directly manage cgroups is already
severely broken regardless of this patch - each block cgroup
consumes kernel memory and skews IO weight (IO weights are not
hierarchical).
v2: queue-sysfs.txt updated and patch description udpated as suggested
by Vivek.
v3: blk_get_rl() wasn't checking error return from
blkg_lookup_create() and may cause oops on lookup failure. Fix it
by falling back to root_rl on blkg lookup failures. This problem
was spotted by Rakesh Iyer <rni@google.com>.
v4: Updated to accomodate 458f27a982 "block: Avoid missed wakeup in
request waitqueue". blk_drain_queue() now wakes up waiters on all
blkg->rl on the target queue.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2012-06-27 06:05:44 +08:00
|
|
|
regulated by nr_requests.
|
|
|
|
|
2012-08-09 21:28:05 +08:00
|
|
|
optimal_io_size (RO)
|
|
|
|
--------------------
|
2014-08-26 18:33:20 +08:00
|
|
|
This is the optimal IO size reported by the device.
|
2012-08-09 21:28:05 +08:00
|
|
|
|
|
|
|
physical_block_size (RO)
|
|
|
|
------------------------
|
|
|
|
This is the physical block size of device, in bytes.
|
|
|
|
|
2009-02-02 20:02:31 +08:00
|
|
|
read_ahead_kb (RW)
|
|
|
|
------------------
|
|
|
|
Maximum number of kilobytes to read-ahead for filesystems on this block
|
|
|
|
device.
|
|
|
|
|
2012-08-09 21:28:05 +08:00
|
|
|
rotational (RW)
|
|
|
|
---------------
|
|
|
|
This file is used to stat if the device is of rotational type or
|
|
|
|
non-rotational type.
|
|
|
|
|
2009-02-02 20:02:31 +08:00
|
|
|
rq_affinity (RW)
|
|
|
|
----------------
|
2011-07-24 02:44:25 +08:00
|
|
|
If this option is '1', the block layer will migrate request completions to the
|
|
|
|
cpu "group" that originally submitted the request. For some workloads this
|
|
|
|
provides a significant reduction in CPU cycles due to caching effects.
|
|
|
|
|
|
|
|
For storage configurations that need to maximize distribution of completion
|
|
|
|
processing setting this option to '2' forces the completion to run on the
|
|
|
|
requesting cpu (bypassing the "group" aggregation logic).
|
2009-02-02 20:02:31 +08:00
|
|
|
|
|
|
|
scheduler (RW)
|
|
|
|
--------------
|
|
|
|
When read, this file will display the current and available IO schedulers
|
|
|
|
for this block device. The currently active IO scheduler will be enclosed
|
|
|
|
in [] brackets. Writing an IO scheduler name to this file will switch
|
|
|
|
control of this block device to that new IO scheduler. Note that writing
|
|
|
|
an IO scheduler name to this file will attempt to load that IO scheduler
|
|
|
|
module, if it isn't already present in the system.
|
|
|
|
|
2016-04-13 02:32:46 +08:00
|
|
|
write_cache (RW)
|
|
|
|
----------------
|
|
|
|
When read, this file will display whether the device has write back
|
|
|
|
caching enabled or not. It will return "write back" for the former
|
|
|
|
case, and "write through" for the latter. Writing to this file can
|
|
|
|
change the kernels view of the device, but it doesn't alter the
|
|
|
|
device state. This means that it might not be safe to toggle the
|
|
|
|
setting from "write back" to "write through", since that will also
|
|
|
|
eliminate cache flushes issued by the kernel.
|
2009-02-02 20:02:31 +08:00
|
|
|
|
|
|
|
|
|
|
|
Jens Axboe <jens.axboe@oracle.com>, February 2009
|