Loading block/bfq-cgroup.c +30 −42 Original line number Original line Diff line number Diff line Loading @@ -315,9 +315,6 @@ static struct bfq_group *__bfq_bic_change_cgroup(struct bfq_data *bfqd, struct bfq_queue *sync_bfqq = bic_to_bfqq(bic, 1); struct bfq_queue *sync_bfqq = bic_to_bfqq(bic, 1); struct bfq_entity *entity; struct bfq_entity *entity; struct bfq_group *bfqg; struct bfq_group *bfqg; struct bfqio_cgroup *bgrp; bgrp = cgroup_to_bfqio(cgroup); bfqg = bfq_find_alloc_group(bfqd, cgroup); bfqg = bfq_find_alloc_group(bfqd, cgroup); if (async_bfqq != NULL) { if (async_bfqq != NULL) { Loading Loading @@ -736,16 +733,14 @@ static struct cgroup_subsys_state *bfqio_create(struct cgroup_subsys *subsys, * will not be destroyed until the tasks sharing the ioc die. * will not be destroyed until the tasks sharing the ioc die. */ */ static int bfqio_can_attach(struct cgroup_subsys *subsys, struct cgroup *cgroup, static int bfqio_can_attach(struct cgroup_subsys *subsys, struct cgroup *cgroup, struct cgroup_taskset *tset) struct task_struct *tsk) { { struct task_struct *task; struct io_context *ioc; struct io_context *ioc; int ret = 0; int ret = 0; cgroup_taskset_for_each(task, cgroup, tset) { /* task_lock() is needed to avoid races with exit_io_context() */ /* task_lock() is needed to avoid races with exit_io_context() */ task_lock(task); task_lock(tsk); ioc = task->io_context; ioc = tsk->io_context; if (ioc != NULL && atomic_read(&ioc->nr_tasks) > 1) if (ioc != NULL && atomic_read(&ioc->nr_tasks) > 1) /* /* * ioc == NULL means that the task is either too young or * ioc == NULL means that the task is either too young or Loading @@ -754,42 +749,35 @@ static int bfqio_can_attach(struct cgroup_subsys *subsys, struct cgroup *cgroup, * matter what we return here. * matter what we return here. */ */ ret = -EINVAL; ret = -EINVAL; task_unlock(task); task_unlock(tsk); if (ret) break; } return ret; return ret; } } static void bfqio_attach(struct cgroup_subsys *subsys, struct cgroup *cgroup, static void bfqio_attach(struct cgroup_subsys *subsys, struct cgroup *cgroup, struct cgroup_taskset *tset) struct cgroup *prev, struct task_struct *tsk) { { struct task_struct *task; struct io_context *ioc; struct io_context *ioc; struct io_cq *icq; struct io_cq *icq; struct hlist_node *n; struct hlist_node *n; /* task_lock(tsk); * IMPORTANT NOTE: The move of more than one process at a time to a ioc = tsk->io_context; * new group has not yet been tested. if (ioc != NULL) { */ BUG_ON(atomic_long_read(&ioc->refcount) == 0); cgroup_taskset_for_each(task, cgroup, tset) { atomic_long_inc(&ioc->refcount); ioc = get_task_io_context(task, GFP_ATOMIC, NUMA_NO_NODE); } if (ioc) { task_unlock(tsk); /* * Handle cgroup change here. if (ioc == NULL) */ return; rcu_read_lock(); rcu_read_lock(); hlist_for_each_entry_rcu(icq, n, &ioc->icq_list, ioc_node) hlist_for_each_entry_rcu(icq, n, &ioc->icq_list, ioc_node) if (!strncmp(icq->q->elevator->type->elevator_name, bfq_bic_change_cgroup(icq_to_bic(icq), cgroup); "bfq", ELV_NAME_MAX)) bfq_bic_change_cgroup(icq_to_bic(icq), cgroup); rcu_read_unlock(); rcu_read_unlock(); put_io_context(ioc); } put_io_context(ioc, NULL); } } } static void bfqio_destroy(struct cgroup_subsys *subsys, struct cgroup *cgroup) static void bfqio_destroy(struct cgroup_subsys *subsys, struct cgroup *cgroup) Loading block/bfq-iosched.c +3 −2 Original line number Original line Diff line number Diff line Loading @@ -2729,7 +2729,8 @@ static int bfq_set_request(struct request_queue *q, struct request *rq, bool split = false; bool split = false; /* handle changed prio notifications; cgroup change is handled separately */ /* handle changed prio notifications; cgroup change is handled separately */ if (unlikely(icq_get_changed(&bic->icq) & ICQ_IOPRIO_CHANGED)) if (unlikely(bic->icq.changed)) if (test_and_clear_bit(ICQ_IOPRIO_CHANGED, &bic->icq.changed)) bfq_changed_ioprio(bic->icq.ioc, bic); bfq_changed_ioprio(bic->icq.ioc, bic); might_sleep_if(gfp_mask & __GFP_WAIT); might_sleep_if(gfp_mask & __GFP_WAIT); Loading block/bfq-sched.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -981,7 +981,7 @@ static struct bfq_queue *bfq_get_next_queue(struct bfq_data *bfqd) static void __bfq_bfqd_reset_active(struct bfq_data *bfqd) static void __bfq_bfqd_reset_active(struct bfq_data *bfqd) { { if (bfqd->active_bic != NULL) { if (bfqd->active_bic != NULL) { put_io_context(bfqd->active_bic->icq.ioc); put_io_context(bfqd->active_bic->icq.ioc, NULL); bfqd->active_bic = NULL; bfqd->active_bic = NULL; } } Loading Loading
block/bfq-cgroup.c +30 −42 Original line number Original line Diff line number Diff line Loading @@ -315,9 +315,6 @@ static struct bfq_group *__bfq_bic_change_cgroup(struct bfq_data *bfqd, struct bfq_queue *sync_bfqq = bic_to_bfqq(bic, 1); struct bfq_queue *sync_bfqq = bic_to_bfqq(bic, 1); struct bfq_entity *entity; struct bfq_entity *entity; struct bfq_group *bfqg; struct bfq_group *bfqg; struct bfqio_cgroup *bgrp; bgrp = cgroup_to_bfqio(cgroup); bfqg = bfq_find_alloc_group(bfqd, cgroup); bfqg = bfq_find_alloc_group(bfqd, cgroup); if (async_bfqq != NULL) { if (async_bfqq != NULL) { Loading Loading @@ -736,16 +733,14 @@ static struct cgroup_subsys_state *bfqio_create(struct cgroup_subsys *subsys, * will not be destroyed until the tasks sharing the ioc die. * will not be destroyed until the tasks sharing the ioc die. */ */ static int bfqio_can_attach(struct cgroup_subsys *subsys, struct cgroup *cgroup, static int bfqio_can_attach(struct cgroup_subsys *subsys, struct cgroup *cgroup, struct cgroup_taskset *tset) struct task_struct *tsk) { { struct task_struct *task; struct io_context *ioc; struct io_context *ioc; int ret = 0; int ret = 0; cgroup_taskset_for_each(task, cgroup, tset) { /* task_lock() is needed to avoid races with exit_io_context() */ /* task_lock() is needed to avoid races with exit_io_context() */ task_lock(task); task_lock(tsk); ioc = task->io_context; ioc = tsk->io_context; if (ioc != NULL && atomic_read(&ioc->nr_tasks) > 1) if (ioc != NULL && atomic_read(&ioc->nr_tasks) > 1) /* /* * ioc == NULL means that the task is either too young or * ioc == NULL means that the task is either too young or Loading @@ -754,42 +749,35 @@ static int bfqio_can_attach(struct cgroup_subsys *subsys, struct cgroup *cgroup, * matter what we return here. * matter what we return here. */ */ ret = -EINVAL; ret = -EINVAL; task_unlock(task); task_unlock(tsk); if (ret) break; } return ret; return ret; } } static void bfqio_attach(struct cgroup_subsys *subsys, struct cgroup *cgroup, static void bfqio_attach(struct cgroup_subsys *subsys, struct cgroup *cgroup, struct cgroup_taskset *tset) struct cgroup *prev, struct task_struct *tsk) { { struct task_struct *task; struct io_context *ioc; struct io_context *ioc; struct io_cq *icq; struct io_cq *icq; struct hlist_node *n; struct hlist_node *n; /* task_lock(tsk); * IMPORTANT NOTE: The move of more than one process at a time to a ioc = tsk->io_context; * new group has not yet been tested. if (ioc != NULL) { */ BUG_ON(atomic_long_read(&ioc->refcount) == 0); cgroup_taskset_for_each(task, cgroup, tset) { atomic_long_inc(&ioc->refcount); ioc = get_task_io_context(task, GFP_ATOMIC, NUMA_NO_NODE); } if (ioc) { task_unlock(tsk); /* * Handle cgroup change here. if (ioc == NULL) */ return; rcu_read_lock(); rcu_read_lock(); hlist_for_each_entry_rcu(icq, n, &ioc->icq_list, ioc_node) hlist_for_each_entry_rcu(icq, n, &ioc->icq_list, ioc_node) if (!strncmp(icq->q->elevator->type->elevator_name, bfq_bic_change_cgroup(icq_to_bic(icq), cgroup); "bfq", ELV_NAME_MAX)) bfq_bic_change_cgroup(icq_to_bic(icq), cgroup); rcu_read_unlock(); rcu_read_unlock(); put_io_context(ioc); } put_io_context(ioc, NULL); } } } static void bfqio_destroy(struct cgroup_subsys *subsys, struct cgroup *cgroup) static void bfqio_destroy(struct cgroup_subsys *subsys, struct cgroup *cgroup) Loading
block/bfq-iosched.c +3 −2 Original line number Original line Diff line number Diff line Loading @@ -2729,7 +2729,8 @@ static int bfq_set_request(struct request_queue *q, struct request *rq, bool split = false; bool split = false; /* handle changed prio notifications; cgroup change is handled separately */ /* handle changed prio notifications; cgroup change is handled separately */ if (unlikely(icq_get_changed(&bic->icq) & ICQ_IOPRIO_CHANGED)) if (unlikely(bic->icq.changed)) if (test_and_clear_bit(ICQ_IOPRIO_CHANGED, &bic->icq.changed)) bfq_changed_ioprio(bic->icq.ioc, bic); bfq_changed_ioprio(bic->icq.ioc, bic); might_sleep_if(gfp_mask & __GFP_WAIT); might_sleep_if(gfp_mask & __GFP_WAIT); Loading
block/bfq-sched.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -981,7 +981,7 @@ static struct bfq_queue *bfq_get_next_queue(struct bfq_data *bfqd) static void __bfq_bfqd_reset_active(struct bfq_data *bfqd) static void __bfq_bfqd_reset_active(struct bfq_data *bfqd) { { if (bfqd->active_bic != NULL) { if (bfqd->active_bic != NULL) { put_io_context(bfqd->active_bic->icq.ioc); put_io_context(bfqd->active_bic->icq.ioc, NULL); bfqd->active_bic = NULL; bfqd->active_bic = NULL; } } Loading