Skip to content
  1. Aug 10, 2021
  2. Aug 06, 2021
    • Bart Van Assche's avatar
      loop: Select I/O scheduler 'none' from inside add_disk() · 2112f5c1
      Bart Van Assche authored
      
      
      We noticed that the user interface of Android devices becomes very slow
      under memory pressure. This is because Android uses the zram driver on top
      of the loop driver for swapping, because under memory pressure the swap
      code alternates reads and writes quickly, because mq-deadline is the
      default scheduler for loop devices and because mq-deadline delays writes by
      five seconds for such a workload with default settings. Fix this by making
      the kernel select I/O scheduler 'none' from inside add_disk() for loop
      devices. This default can be overridden at any time from user space,
      e.g. via a udev rule. This approach has an advantage compared to changing
      the I/O scheduler from userspace from 'mq-deadline' into 'none', namely
      that synchronize_rcu() does not get called.
      
      This patch changes the default I/O scheduler for loop devices from
      'mq-deadline' into 'none'.
      
      Additionally, this patch reduces the Android boot time on my test setup
      with 0.5 seconds compared to configuring the loop I/O scheduler from user
      space.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Ming Lei <ming.lei@redhat.com>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Martijn Coenen <maco@android.com>
      Cc: Jaegeuk Kim <jaegeuk@kernel.org>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Link: https://lore.kernel.org/r/20210805174200.3250718-3-bvanassche@acm.org
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      2112f5c1
    • Bart Van Assche's avatar
      blk-mq: Introduce the BLK_MQ_F_NO_SCHED_BY_DEFAULT flag · 90b71980
      Bart Van Assche authored
      
      
      elevator_get_default() uses the following algorithm to select an I/O
      scheduler from inside add_disk():
      - In case of a single hardware queue or if sharing hardware queues across
        multiple request queues (BLK_MQ_F_TAG_HCTX_SHARED), use mq-deadline.
      - Otherwise, use 'none'.
      
      This is a good choice for most but not for all block drivers. Make it
      possible to override the selection of mq-deadline with a new flag,
      namely BLK_MQ_F_NO_SCHED_BY_DEFAULT.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Ming Lei <ming.lei@redhat.com>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Martijn Coenen <maco@android.com>
      Cc: Jaegeuk Kim <jaegeuk@kernel.org>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Link: https://lore.kernel.org/r/20210805174200.3250718-2-bvanassche@acm.org
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      90b71980
  3. Aug 03, 2021