From: Tejun Heo tj@kernel.org
mainline inclusion from mainline-5.4-rc1 commit cf09a8ee19ad1f78b4e18cdde9f2a61133efacf5 category: feature bugzilla: 38688 CVE: NA
---------------------------
Instead of @node, pass in @q and @blkcg so that the alloc function has more context. This doesn't cause any behavior change and will be used by io.weight implementation.
Signed-off-by: Tejun Heo tj@kernel.org Signed-off-by: Jens Axboe axboe@kernel.dk
Conflits: block/blk-iolatency.c block/blk-cgroup.c block/cfq-iosched.c Signed-off-by: Yu Kuai yukuai3@huawei.com Reviewed-by: Hou Tao houtao1@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- block/bfq-cgroup.c | 5 +++-- block/blk-cgroup.c | 6 +++--- block/blk-iolatency.c | 5 +++-- block/blk-throttle.c | 6 ++++-- block/cfq-iosched.c | 5 +++-- include/linux/blk-cgroup.h | 3 ++- 6 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index ecd3d0ec2f3b6..9c3957d37069f 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -434,11 +434,12 @@ static void bfq_cpd_free(struct blkcg_policy_data *cpd) kfree(cpd_to_bfqgd(cpd)); }
-static struct blkg_policy_data *bfq_pd_alloc(gfp_t gfp, int node) +static struct blkg_policy_data *bfq_pd_alloc(gfp_t gfp, struct request_queue *q, + struct blkcg *blkcg) { struct bfq_group *bfqg;
- bfqg = kzalloc_node(sizeof(*bfqg), gfp, node); + bfqg = kzalloc_node(sizeof(*bfqg), gfp, q->node); if (!bfqg) return NULL;
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 003965683d0f2..6d218ac900715 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -127,7 +127,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q, continue;
/* alloc per-policy data and attach it to blkg */ - pd = pol->pd_alloc_fn(gfp_mask, q->node); + pd = pol->pd_alloc_fn(gfp_mask, q, blkcg); if (!pd) goto err_free;
@@ -1436,7 +1436,7 @@ int blkcg_activate_policy(struct request_queue *q, blk_queue_bypass_start(q); pd_prealloc: if (!pd_prealloc) { - pd_prealloc = pol->pd_alloc_fn(GFP_KERNEL, q->node); + pd_prealloc = pol->pd_alloc_fn(GFP_KERNEL, q, &blkcg_root); if (!pd_prealloc) { ret = -ENOMEM; goto out_bypass_end; @@ -1451,7 +1451,7 @@ int blkcg_activate_policy(struct request_queue *q, if (blkg->pd[pol->plid]) continue;
- pd = pol->pd_alloc_fn(GFP_NOWAIT | __GFP_NOWARN, q->node); + pd = pol->pd_alloc_fn(GFP_NOWAIT | __GFP_NOWARN, q, &blkcg_root); if (!pd) swap(pd, pd_prealloc); if (!pd) { diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index 0529e94a20f7f..11de05b36cc7c 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c @@ -869,11 +869,12 @@ static size_t iolatency_pd_stat(struct blkg_policy_data *pd, char *buf, }
-static struct blkg_policy_data *iolatency_pd_alloc(gfp_t gfp, int node) +static struct blkg_policy_data *iolatency_pd_alloc(gfp_t gfp, + struct request_queue *q, struct blkcg *blkcg) { struct iolatency_grp *iolat;
- iolat = kzalloc_node(sizeof(*iolat), gfp, node); + iolat = kzalloc_node(sizeof(*iolat), gfp, q->node); if (!iolat) return NULL; iolat->stats = __alloc_percpu_gfp(sizeof(struct blk_rq_stat), diff --git a/block/blk-throttle.c b/block/blk-throttle.c index caee658609d73..76abcd771a5f2 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -479,12 +479,14 @@ static void throtl_service_queue_init(struct throtl_service_queue *sq) timer_setup(&sq->pending_timer, throtl_pending_timer_fn, 0); }
-static struct blkg_policy_data *throtl_pd_alloc(gfp_t gfp, int node) +static struct blkg_policy_data *throtl_pd_alloc(gfp_t gfp, + struct request_queue *q, + struct blkcg *blkcg) { struct throtl_grp *tg; int rw;
- tg = kzalloc_node(sizeof(*tg), gfp, node); + tg = kzalloc_node(sizeof(*tg), gfp, q->node); if (!tg) return NULL;
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 2eb87444b1572..ea5e9e9e91e6a 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -1612,11 +1612,12 @@ static void cfq_cpd_bind(struct blkcg_policy_data *cpd) WARN_ON_ONCE(__cfq_set_weight(&blkcg->css, weight, on_dfl, true, true)); }
-static struct blkg_policy_data *cfq_pd_alloc(gfp_t gfp, int node) +static struct blkg_policy_data *cfq_pd_alloc(gfp_t gfp, struct request_queue *q, + struct blkcg *blkcg) { struct cfq_group *cfqg;
- cfqg = kzalloc_node(sizeof(*cfqg), gfp, node); + cfqg = kzalloc_node(sizeof(*cfqg), gfp, q->node); if (!cfqg) return NULL;
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 911cc20d959a6..e65ec627844c5 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -154,7 +154,8 @@ typedef struct blkcg_policy_data *(blkcg_pol_alloc_cpd_fn)(gfp_t gfp); typedef void (blkcg_pol_init_cpd_fn)(struct blkcg_policy_data *cpd); typedef void (blkcg_pol_free_cpd_fn)(struct blkcg_policy_data *cpd); typedef void (blkcg_pol_bind_cpd_fn)(struct blkcg_policy_data *cpd); -typedef struct blkg_policy_data *(blkcg_pol_alloc_pd_fn)(gfp_t gfp, int node); +typedef struct blkg_policy_data *(blkcg_pol_alloc_pd_fn)(gfp_t gfp, + struct request_queue *q, struct blkcg *blkcg); typedef void (blkcg_pol_init_pd_fn)(struct blkg_policy_data *pd); typedef void (blkcg_pol_online_pd_fn)(struct blkg_policy_data *pd); typedef void (blkcg_pol_offline_pd_fn)(struct blkg_policy_data *pd);