aboutsummaryrefslogtreecommitdiffstats
path: root/block/ll_rw_blk.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-01-24 02:52:45 -0500
committerJens Axboe <jens.axboe@oracle.com>2008-01-28 04:50:29 -0500
commitfd0928df98b9578be8a786ac0cb78a47a5e17a20 (patch)
tree70a34cf207bea1bec28e59cf0dba7d20e7f8b0f1 /block/ll_rw_blk.c
parent91525300baf162e83e923b09ca286f9205e21522 (diff)
ioprio: move io priority from task_struct to io_context
This is where it belongs and then it doesn't take up space for a process that doesn't do IO. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/ll_rw_blk.c')
-rw-r--r--block/ll_rw_blk.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 3d0422f48453..b9bb02e845cd 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -3904,6 +3904,26 @@ void exit_io_context(void)
3904 put_io_context(ioc); 3904 put_io_context(ioc);
3905} 3905}
3906 3906
3907struct io_context *alloc_io_context(gfp_t gfp_flags, int node)
3908{
3909 struct io_context *ret;
3910
3911 ret = kmem_cache_alloc_node(iocontext_cachep, gfp_flags, node);
3912 if (ret) {
3913 atomic_set(&ret->refcount, 1);
3914 ret->task = current;
3915 ret->ioprio_changed = 0;
3916 ret->ioprio = 0;
3917 ret->last_waited = jiffies; /* doesn't matter... */
3918 ret->nr_batch_requests = 0; /* because this is 0 */
3919 ret->aic = NULL;
3920 ret->cic_root.rb_node = NULL;
3921 ret->ioc_data = NULL;
3922 }
3923
3924 return ret;
3925}
3926
3907/* 3927/*
3908 * If the current task has no IO context then create one and initialise it. 3928 * If the current task has no IO context then create one and initialise it.
3909 * Otherwise, return its existing IO context. 3929 * Otherwise, return its existing IO context.
@@ -3921,16 +3941,8 @@ static struct io_context *current_io_context(gfp_t gfp_flags, int node)
3921 if (likely(ret)) 3941 if (likely(ret))
3922 return ret; 3942 return ret;
3923 3943
3924 ret = kmem_cache_alloc_node(iocontext_cachep, gfp_flags, node); 3944 ret = alloc_io_context(gfp_flags, node);
3925 if (ret) { 3945 if (ret) {
3926 atomic_set(&ret->refcount, 1);
3927 ret->task = current;
3928 ret->ioprio_changed = 0;
3929 ret->last_waited = jiffies; /* doesn't matter... */
3930 ret->nr_batch_requests = 0; /* because this is 0 */
3931 ret->aic = NULL;
3932 ret->cic_root.rb_node = NULL;
3933 ret->ioc_data = NULL;
3934 /* make sure set_task_ioprio() sees the settings above */ 3946 /* make sure set_task_ioprio() sees the settings above */
3935 smp_wmb(); 3947 smp_wmb();
3936 tsk->io_context = ret; 3948 tsk->io_context = ret;