Skip to content
  • Tejun Heo's avatar
    sched/core: move IO scheduling accounting from io_schedule_timeout() into scheduler · e33a9bba
    Tejun Heo authored
    
    
    For an interface to support blocking for IOs, it must call
    io_schedule() instead of schedule().  This makes it tedious to add IO
    blocking to existing interfaces as the switching between schedule()
    and io_schedule() is often buried deep.
    
    As we already have a way to mark the task as IO scheduling, this can
    be made easier by separating out io_schedule() into multiple steps so
    that IO schedule preparation can be performed before invoking a
    blocking interface and the actual accounting happens inside the
    scheduler.
    
    io_schedule_timeout() does the following three things prior to calling
    schedule_timeout().
    
     1. Mark the task as scheduling for IO.
     2. Flush out plugged IOs.
     3. Account the IO scheduling.
    
    done close to the actual scheduling.  This patch moves #3 into the
    scheduler so that later patches can separate out preparation and
    finish steps from io_schedule().
    
    Patch-originally-by: default avatarPeter Zijlstra <peterz@infradead.org>
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: adilger.kernel@dilger.ca
    Cc: akpm@linux-foundation.org
    Cc: axboe@kernel.dk
    Cc: jack@suse.com
    Cc: kernel-team@fb.com
    Cc: mingbo@fb.com
    Cc: tytso@mit.edu
    Link: http://lkml.kernel.org/r/20161207204841.GA22296@htj.duckdns.org
    
    
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    e33a9bba