Skip to content
Permalink
Yu-Kuai/optimi…
Switch branches/tags

Commits on Oct 13, 2021

  1. block, bfq: do not idle if only one cgroup is activated

    If only one group is activated, there is no need to guarantee the
    same share of the throughput of queues in the same group.
    
    Test procedure:
    run "fio -numjobs=1 -ioengine=psync -bs=4k -direct=1 -rw=randread..."
    multiple times in the same cgroup.
    
    Test result: total bandwidth(Mib/s)
    | total jobs | before this patch | after this patch      |
    | ---------- | ----------------- | --------------------- |
    | 1          | 33.8              | 33.8                  |
    | 2          | 33.8              | 65.4 (32.7 each job)  |
    | 4          | 33.8              | 106.8 (26.7 each job) |
    | 8          | 33.8              | 126.4 (15.8 each job) |
    
    By the way, if I test with "fio -numjobs=1/2/4/8 ...", test result is
    the same with or without this patch. This is because bfq_queue can
    be merged in this situation.
    
    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
    Yu Kuai authored and intel-lab-lkp committed Oct 13, 2021
  2. block, bfq: counted root group into 'num_groups_with_pending_reqs'

    'num_groups_with_pending_reqs' represents how many groups that are
    not root group and have pending requests. This patch also counted
    root group into 'num_groups_with_pending_reqs'.
    
    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
    Yu Kuai authored and intel-lab-lkp committed Oct 13, 2021

Commits on Oct 12, 2021

  1. Merge branch 'for-5.16/block' into for-next

    * for-5.16/block:
      block: mark bio_truncate static
      block: move bio_get_{first,last}_bvec out of bio.h
      block: mark __bio_try_merge_page static
      block: move bio_full out of bio.h
      block: fold bio_cur_bytes into blk_rq_cur_bytes
      block: move bio_mergeable out of bio.h
      block: don't include <linux/ioprio.h> in <linux/bio.h>
      block: remove BIO_BUG_ON
    axboe committed Oct 12, 2021
  2. block: mark bio_truncate static

    bio_truncate is only used in bio.c, so mark it static.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20211012161804.991559-9-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  3. block: move bio_get_{first,last}_bvec out of bio.h

    bio_get_first_bvec and bio_get_last_bvec are only used in blk-merge.c,
    so move them there.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20211012161804.991559-8-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  4. block: mark __bio_try_merge_page static

    Mark __bio_try_merge_page static and move it up a bit to avoid the need
    for a forward declaration.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20211012161804.991559-7-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  5. block: move bio_full out of bio.h

    bio_full is only used in bio.c, so move it there.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20211012161804.991559-6-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  6. block: fold bio_cur_bytes into blk_rq_cur_bytes

    Fold bio_cur_bytes into the only caller.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20211012161804.991559-5-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  7. block: move bio_mergeable out of bio.h

    bio_mergeable is only needed by I/O schedulers, so move it to
    blk-mq-sched.h.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20211012161804.991559-4-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  8. block: don't include <linux/ioprio.h> in <linux/bio.h>

    bio.h doesn't need any of the definitions from ioprio.h.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20211012161804.991559-3-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  9. block: remove BIO_BUG_ON

    BIO_DEBUG is always defined, so just switch the two instances to use
    BUG_ON directly.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20211012161804.991559-2-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  10. Merge branch 'for-5.16/block' into for-next

    * for-5.16/block:
      blk-mq: inline hot part of __blk_mq_sched_restart
      block: inline hot paths of blk_account_io_*()
    axboe committed Oct 12, 2021
  11. blk-mq: inline hot part of __blk_mq_sched_restart

    Extract a fast check out of __block_mq_sched_restart() and inline it for
    performance reasons.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/894abaa0998e5999f2fe18f271e5efdfc2c32bd2.1633781740.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    isilence authored and axboe committed Oct 12, 2021
  12. block: inline hot paths of blk_account_io_*()

    Extract hot paths of __blk_account_io_start() and
    __blk_account_io_done() into inline functions, so we don't always pay
    for function calls.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/b0662a636bd4cc7b4f84c9d0a41efa46a688ef13.1633781740.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    isilence authored and axboe committed Oct 12, 2021
  13. Merge branch 'for-5.16/block-io_uring' into for-next

    * for-5.16/block-io_uring: (78 commits)
      nvme-multipath: enable polled I/O
      block: don't allow writing to the poll queue attribute
      block: switch polling to be bio based
      block: define 'struct bvec_iter' as packed
      block: use SLAB_TYPESAFE_BY_RCU for the bio slab
      block: rename REQ_HIPRI to REQ_POLLED
      io_uring: don't sleep when polling for I/O
      block: replace the spin argument to blk_iopoll with a flags argument
      blk-mq: remove blk_qc_t_valid
      blk-mq: remove blk_qc_t_to_tag and blk_qc_t_is_internal
      blk-mq: factor out a "classic" poll helper
      blk-mq: factor out a blk_qc_to_hctx helper
      io_uring: fix a layering violation in io_iopoll_req_issued
      iomap: don't try to poll multi-bio I/Os in __iomap_dio_rw
      block: don't try to poll multi-bio I/Os in __blkdev_direct_IO
      direct-io: remove blk_poll support
      io_uring: inform block layer of how many requests we are submitting
      io_uring: fix io_free_batch_list races
      io_uring: remove extra io_ring_exit_work wake up
      io_uring: optimise out req->opcode reloading
      ...
    axboe committed Oct 12, 2021
  14. Merge branch 'for-5.16/drivers' into for-next

    * for-5.16/drivers: (41 commits)
      brd: reduce the brd_devices_mutex scope
      swim3: add missing major.h include
      sx8: fix an error code in carm_init_one()
      pf: fix error codes in pf_init_unit()
      pcd: fix error codes in pcd_init_unit()
      xtensa/platforms/iss/simdisk: add error handling support for add_disk()
      block/ataflop: add error handling support for add_disk()
      block/ataflop: provide a helper for cleanup up an atari disk
      block/ataflop: add registration bool before calling del_gendisk()
      block/ataflop: use the blk_cleanup_disk() helper
      swim: add error handling support for add_disk()
      swim: add a floppy registration bool which triggers del_gendisk()
      swim: add helper for disk cleanup
      swim: simplify using blk_cleanup_disk() on swim_remove()
      amiflop: add error handling support for add_disk()
      floppy: add error handling support for add_disk()
      floppy: fix calling platform_device_unregister() on invalid drives
      floppy: use blk_cleanup_disk()
      floppy: fix add_disk() assumption on exit due to new developments
      block/swim3: add error handling support for add_disk()
      ...
    axboe committed Oct 12, 2021
  15. Merge branch 'for-5.16/block' into for-next

    * for-5.16/block: (45 commits)
      block: merge block_ioctl into blkdev_ioctl
      block: move the *blkdev_ioctl declarations out of blkdev.h
      block: unexport blkdev_ioctl
      blk-mq: cleanup blk_mq_submit_bio
      blk-mq: cleanup and rename __blk_mq_alloc_request
      block: pre-allocate requests if plug is started and is a batch
      block: bump max plugged deferred size from 16 to 32
      block: inherit request start time from bio for BLK_CGROUP
      block: move blk-throtl fast path inline
      blk-mq: Change shared sbitmap naming to shared tags
      blk-mq: Stop using pointers for blk_mq_tags bitmap tags
      blk-mq: Use shared tags for shared sbitmap support
      blk-mq: Refactor and rename blk_mq_free_map_and_{requests->rqs}()
      blk-mq: Add blk_mq_alloc_map_and_rqs()
      blk-mq: Add blk_mq_tag_update_sched_shared_sbitmap()
      blk-mq: Don't clear driver tags own mapping
      blk-mq: Pass driver tags to blk_mq_clear_rq_mapping()
      blk-mq-sched: Rename blk_mq_sched_free_{requests -> rqs}()
      blk-mq-sched: Rename blk_mq_sched_alloc_{tags -> map_and_rqs}()
      blk-mq: Invert check in blk_mq_update_nr_requests()
      ...
    axboe committed Oct 12, 2021
  16. Merge branch 'for-5.16/cdrom' into for-next

    * for-5.16/cdrom:
      cdrom: docs: reformat table in Documentation/userspace-api/ioctl/cdrom.rst
      drivers/cdrom: improved ioctl for media change detection
    axboe committed Oct 12, 2021
  17. nvme-multipath: enable polled I/O

    Set the poll queue flag to enable polling, given that the multipath
    node just dispatches the bios to a lower queue.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-17-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  18. block: don't allow writing to the poll queue attribute

    The poll attribute is a historic artefact from before when we had
    explicit poll queues that require driver specific configuration.
    Just print a warning when writing to the attribute.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-16-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  19. block: switch polling to be bio based

    Replace the blk_poll interface that requires the caller to keep a queue
    and cookie from the submissions with polling based on the bio.
    
    Polling for the bio itself leads to a few advantages:
    
     - the cookie construction can made entirely private in blk-mq.c
     - the caller does not need to remember the request_queue and cookie
       separately and thus sidesteps their lifetime issues
     - keeping the device and the cookie inside the bio allows to trivially
       support polling BIOs remapping by stacking drivers
     - a lot of code to propagate the cookie back up the submission path can
       be removed entirely.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-15-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  20. block: define 'struct bvec_iter' as packed

    'struct bvec_iter' is embedded into 'struct bio', define it as packed
    so that we can get one extra 4bytes for other uses without expanding
    bio.
    
    'struct bvec_iter' is often allocated on stack, so making it packed
    doesn't affect performance. Also I have run io_uring on both
    nvme/null_blk, and not observe performance effect in this way.
    
    Suggested-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Ming Lei <ming.lei@redhat.com>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-14-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Ming Lei authored and axboe committed Oct 12, 2021
  21. block: use SLAB_TYPESAFE_BY_RCU for the bio slab

    This flags ensures that the pages will not be reused for non-bio
    allocations before the end of an RCU grace period.  With that we can
    safely use a RCU lookup for bio polling as long as we are fine with
    occasionally polling the wrong device.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-13-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  22. block: rename REQ_HIPRI to REQ_POLLED

    Unlike the RWF_HIPRI userspace ABI which is intentionally kept vague,
    the bio flag is specific to the polling implementation, so rename and
    document it properly.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-12-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  23. io_uring: don't sleep when polling for I/O

    There is no point in sleeping for the expected I/O completion timeout
    in the io_uring async polling model as we never poll for a specific
    I/O.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-11-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  24. block: replace the spin argument to blk_iopoll with a flags argument

    Switch the boolean spin argument to blk_poll to passing a set of flags
    instead.  This will allow to control polling behavior in a more fine
    grained way.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-10-hch@lst.de
    [axboe: adapt to changed io_uring iopoll]
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  25. blk-mq: remove blk_qc_t_valid

    Move the trivial check into the only caller.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-9-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  26. blk-mq: remove blk_qc_t_to_tag and blk_qc_t_is_internal

    Merge both functions into their only caller to keep the blk-mq tag to
    blk_qc_t mapping as private as possible in blk-mq.c.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-8-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  27. blk-mq: factor out a "classic" poll helper

    Factor the code to do the classic full metal polling out of blk_poll into
    a separate blk_mq_poll_classic helper.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-7-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  28. blk-mq: factor out a blk_qc_to_hctx helper

    Add a helper to get the hctx from a request_queue and cookie, and fold
    the blk_qc_t_to_queue_num helper into it as no other callers are left.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-6-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  29. io_uring: fix a layering violation in io_iopoll_req_issued

    syscall-level code can't just poke into the details of the poll cookie,
    which is private information of the block layer.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20211012111226.760968-5-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  30. iomap: don't try to poll multi-bio I/Os in __iomap_dio_rw

    If an iocb is split into multiple bios we can't poll for both.  So don't
    bother to even try to poll in that case.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-4-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  31. block: don't try to poll multi-bio I/Os in __blkdev_direct_IO

    If an iocb is split into multiple bios we can't poll for both.  So don't
    even bother to try to poll in that case.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20211012111226.760968-3-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  32. direct-io: remove blk_poll support

    The polling support in the legacy direct-io support is a little crufty.
    It already doesn't support the asynchronous polling needed for io_uring
    polling, and is hard to adopt to upcoming changes in the polling
    interfaces.  Given that all the major file systems already use the iomap
    direct I/O code, just drop the polling support.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
    Link: https://lore.kernel.org/r/20211012111226.760968-2-hch@lst.de
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Christoph Hellwig authored and axboe committed Oct 12, 2021
  33. io_uring: inform block layer of how many requests we are submitting

    The block layer can use this knowledge to make smarter decisions on
    how to handle the request, if it knows that N more may be coming. Switch
    to using blk_start_plug_nr_ios() to pass in that information.
    
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    axboe committed Oct 12, 2021
Older