linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] block, bfq: remove BFQ_WEIGHT_LEGACY_DFL
@ 2023-03-28 14:56 Chengming Zhou
  2023-03-28 14:56 ` [PATCH 2/4] blk-cgroup: delete cpd_bind_fn of blkcg_policy Chengming Zhou
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Chengming Zhou @ 2023-03-28 14:56 UTC (permalink / raw)
  To: paolo.valente, axboe, tj, josef
  Cc: linux-block, cgroups, linux-kernel, Chengming Zhou

BFQ_WEIGHT_LEGACY_DFL is the same as CGROUP_WEIGHT_DFL, which means
we don't need cpd_bind_fn() callback to update default weight when
attached to a hierarchy.

This patch remove BFQ_WEIGHT_LEGACY_DFL and cpd_bind_fn().

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
 block/bfq-cgroup.c  | 4 +---
 block/bfq-iosched.h | 1 -
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index 89ffb3aa992c..a2ab5dd58068 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -504,8 +504,7 @@ static void bfq_cpd_init(struct blkcg_policy_data *cpd)
 {
 	struct bfq_group_data *d = cpd_to_bfqgd(cpd);
 
-	d->weight = cgroup_subsys_on_dfl(io_cgrp_subsys) ?
-		CGROUP_WEIGHT_DFL : BFQ_WEIGHT_LEGACY_DFL;
+	d->weight = CGROUP_WEIGHT_DFL;
 }
 
 static void bfq_cpd_free(struct blkcg_policy_data *cpd)
@@ -1302,7 +1301,6 @@ struct blkcg_policy blkcg_policy_bfq = {
 
 	.cpd_alloc_fn		= bfq_cpd_alloc,
 	.cpd_init_fn		= bfq_cpd_init,
-	.cpd_bind_fn	        = bfq_cpd_init,
 	.cpd_free_fn		= bfq_cpd_free,
 
 	.pd_alloc_fn		= bfq_pd_alloc,
diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
index 69aaee52285a..467e8cfc41a2 100644
--- a/block/bfq-iosched.h
+++ b/block/bfq-iosched.h
@@ -20,7 +20,6 @@
 
 #define BFQ_DEFAULT_QUEUE_IOPRIO	4
 
-#define BFQ_WEIGHT_LEGACY_DFL	100
 #define BFQ_DEFAULT_GRP_IOPRIO	0
 #define BFQ_DEFAULT_GRP_CLASS	IOPRIO_CLASS_BE
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] blk-cgroup: delete cpd_bind_fn of blkcg_policy
  2023-03-28 14:56 [PATCH 1/4] block, bfq: remove BFQ_WEIGHT_LEGACY_DFL Chengming Zhou
@ 2023-03-28 14:56 ` Chengming Zhou
  2023-03-28 14:57 ` [PATCH 3/4] blk-cgroup: delete cpd_init_fn " Chengming Zhou
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Chengming Zhou @ 2023-03-28 14:56 UTC (permalink / raw)
  To: paolo.valente, axboe, tj, josef
  Cc: linux-block, cgroups, linux-kernel, Chengming Zhou

cpd_bind_fn is just used for update default weight when block
subsys attached to a hierarchy. No any policy need it anymore.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
 block/blk-cgroup.c | 21 ---------------------
 block/blk-cgroup.h |  1 -
 2 files changed, 22 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index bd50b55bdb61..68b797b3f114 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1355,26 +1355,6 @@ void blkcg_exit_disk(struct gendisk *disk)
 	blk_throtl_exit(disk);
 }
 
-static void blkcg_bind(struct cgroup_subsys_state *root_css)
-{
-	int i;
-
-	mutex_lock(&blkcg_pol_mutex);
-
-	for (i = 0; i < BLKCG_MAX_POLS; i++) {
-		struct blkcg_policy *pol = blkcg_policy[i];
-		struct blkcg *blkcg;
-
-		if (!pol || !pol->cpd_bind_fn)
-			continue;
-
-		list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node)
-			if (blkcg->cpd[pol->plid])
-				pol->cpd_bind_fn(blkcg->cpd[pol->plid]);
-	}
-	mutex_unlock(&blkcg_pol_mutex);
-}
-
 static void blkcg_exit(struct task_struct *tsk)
 {
 	if (tsk->throttle_disk)
@@ -1388,7 +1368,6 @@ struct cgroup_subsys io_cgrp_subsys = {
 	.css_offline = blkcg_css_offline,
 	.css_free = blkcg_css_free,
 	.css_rstat_flush = blkcg_rstat_flush,
-	.bind = blkcg_bind,
 	.dfl_cftypes = blkcg_files,
 	.legacy_cftypes = blkcg_legacy_files,
 	.legacy_name = "blkio",
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 9c5078755e5e..26ce62663e27 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -175,7 +175,6 @@ struct blkcg_policy {
 	blkcg_pol_alloc_cpd_fn		*cpd_alloc_fn;
 	blkcg_pol_init_cpd_fn		*cpd_init_fn;
 	blkcg_pol_free_cpd_fn		*cpd_free_fn;
-	blkcg_pol_bind_cpd_fn		*cpd_bind_fn;
 
 	blkcg_pol_alloc_pd_fn		*pd_alloc_fn;
 	blkcg_pol_init_pd_fn		*pd_init_fn;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] blk-cgroup: delete cpd_init_fn of blkcg_policy
  2023-03-28 14:56 [PATCH 1/4] block, bfq: remove BFQ_WEIGHT_LEGACY_DFL Chengming Zhou
  2023-03-28 14:56 ` [PATCH 2/4] blk-cgroup: delete cpd_bind_fn of blkcg_policy Chengming Zhou
@ 2023-03-28 14:57 ` Chengming Zhou
  2023-03-28 14:57 ` [PATCH 4/4] blk-cgroup: change BLKCG_MAX_POLS back to 5 Chengming Zhou
  2023-03-29 18:59 ` [PATCH 1/4] block, bfq: remove BFQ_WEIGHT_LEGACY_DFL Tejun Heo
  3 siblings, 0 replies; 6+ messages in thread
From: Chengming Zhou @ 2023-03-28 14:57 UTC (permalink / raw)
  To: paolo.valente, axboe, tj, josef
  Cc: linux-block, cgroups, linux-kernel, Chengming Zhou

blkcg_policy cpd_init_fn() is used to just initialize some default
fields of policy data, which is enough to do in cpd_alloc_fn().

This patch delete the only user bfq_cpd_init(), and remove cpd_init_fn
from blkcg_policy.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
 block/bfq-cgroup.c | 10 ++--------
 block/blk-cgroup.c |  4 ----
 block/blk-cgroup.h |  1 -
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index a2ab5dd58068..74f7d051665b 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -497,14 +497,9 @@ static struct blkcg_policy_data *bfq_cpd_alloc(gfp_t gfp)
 	bgd = kzalloc(sizeof(*bgd), gfp);
 	if (!bgd)
 		return NULL;
-	return &bgd->pd;
-}
 
-static void bfq_cpd_init(struct blkcg_policy_data *cpd)
-{
-	struct bfq_group_data *d = cpd_to_bfqgd(cpd);
-
-	d->weight = CGROUP_WEIGHT_DFL;
+	bgd->weight = CGROUP_WEIGHT_DFL;
+	return &bgd->pd;
 }
 
 static void bfq_cpd_free(struct blkcg_policy_data *cpd)
@@ -1300,7 +1295,6 @@ struct blkcg_policy blkcg_policy_bfq = {
 	.legacy_cftypes		= bfq_blkcg_legacy_files,
 
 	.cpd_alloc_fn		= bfq_cpd_alloc,
-	.cpd_init_fn		= bfq_cpd_init,
 	.cpd_free_fn		= bfq_cpd_free,
 
 	.pd_alloc_fn		= bfq_pd_alloc,
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 68b797b3f114..18331cb92914 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1249,8 +1249,6 @@ blkcg_css_alloc(struct cgroup_subsys_state *parent_css)
 		blkcg->cpd[i] = cpd;
 		cpd->blkcg = blkcg;
 		cpd->plid = i;
-		if (pol->cpd_init_fn)
-			pol->cpd_init_fn(cpd);
 	}
 
 	spin_lock_init(&blkcg->lock);
@@ -1605,8 +1603,6 @@ int blkcg_policy_register(struct blkcg_policy *pol)
 			blkcg->cpd[pol->plid] = cpd;
 			cpd->blkcg = blkcg;
 			cpd->plid = pol->plid;
-			if (pol->cpd_init_fn)
-				pol->cpd_init_fn(cpd);
 		}
 	}
 
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 26ce62663e27..2c6788658544 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -173,7 +173,6 @@ struct blkcg_policy {
 
 	/* operations */
 	blkcg_pol_alloc_cpd_fn		*cpd_alloc_fn;
-	blkcg_pol_init_cpd_fn		*cpd_init_fn;
 	blkcg_pol_free_cpd_fn		*cpd_free_fn;
 
 	blkcg_pol_alloc_pd_fn		*pd_alloc_fn;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] blk-cgroup: change BLKCG_MAX_POLS back to 5
  2023-03-28 14:56 [PATCH 1/4] block, bfq: remove BFQ_WEIGHT_LEGACY_DFL Chengming Zhou
  2023-03-28 14:56 ` [PATCH 2/4] blk-cgroup: delete cpd_bind_fn of blkcg_policy Chengming Zhou
  2023-03-28 14:57 ` [PATCH 3/4] blk-cgroup: delete cpd_init_fn " Chengming Zhou
@ 2023-03-28 14:57 ` Chengming Zhou
  2023-03-29 18:59 ` [PATCH 1/4] block, bfq: remove BFQ_WEIGHT_LEGACY_DFL Tejun Heo
  3 siblings, 0 replies; 6+ messages in thread
From: Chengming Zhou @ 2023-03-28 14:57 UTC (permalink / raw)
  To: paolo.valente, axboe, tj, josef
  Cc: linux-block, cgroups, linux-kernel, Chengming Zhou

BLKCG_MAX_POLS is changed from 5 to 6 when mq-deadline-cgroup introduced,
then commit 0f7839955114 ("Revert "block/mq-deadline: Add cgroup support"")
reverted it. So change BLKCG_MAX_POLS back to 5.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
 include/linux/blkdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 941304f17492..398f288bcf30 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -54,7 +54,7 @@ extern struct class block_class;
  * Maximum number of blkcg policies allowed to be registered concurrently.
  * Defined here to simplify include dependency.
  */
-#define BLKCG_MAX_POLS		6
+#define BLKCG_MAX_POLS		5
 
 #define DISK_MAX_PARTS			256
 #define DISK_NAME_LEN			32
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/4] block, bfq: remove BFQ_WEIGHT_LEGACY_DFL
  2023-03-28 14:56 [PATCH 1/4] block, bfq: remove BFQ_WEIGHT_LEGACY_DFL Chengming Zhou
                   ` (2 preceding siblings ...)
  2023-03-28 14:57 ` [PATCH 4/4] blk-cgroup: change BLKCG_MAX_POLS back to 5 Chengming Zhou
@ 2023-03-29 18:59 ` Tejun Heo
  2023-04-06 14:34   ` Chengming Zhou
  3 siblings, 1 reply; 6+ messages in thread
From: Tejun Heo @ 2023-03-29 18:59 UTC (permalink / raw)
  To: Chengming Zhou
  Cc: paolo.valente, axboe, josef, linux-block, cgroups, linux-kernel

On Tue, Mar 28, 2023 at 10:56:58PM +0800, Chengming Zhou wrote:
> BFQ_WEIGHT_LEGACY_DFL is the same as CGROUP_WEIGHT_DFL, which means
> we don't need cpd_bind_fn() callback to update default weight when
> attached to a hierarchy.
> 
> This patch remove BFQ_WEIGHT_LEGACY_DFL and cpd_bind_fn().
> 
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>

For 1-3,

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/4] block, bfq: remove BFQ_WEIGHT_LEGACY_DFL
  2023-03-29 18:59 ` [PATCH 1/4] block, bfq: remove BFQ_WEIGHT_LEGACY_DFL Tejun Heo
@ 2023-04-06 14:34   ` Chengming Zhou
  0 siblings, 0 replies; 6+ messages in thread
From: Chengming Zhou @ 2023-04-06 14:34 UTC (permalink / raw)
  To: Tejun Heo; +Cc: paolo.valente, axboe, josef, linux-block, cgroups, linux-kernel

On 2023/3/30 02:59, Tejun Heo wrote:
> On Tue, Mar 28, 2023 at 10:56:58PM +0800, Chengming Zhou wrote:
>> BFQ_WEIGHT_LEGACY_DFL is the same as CGROUP_WEIGHT_DFL, which means
>> we don't need cpd_bind_fn() callback to update default weight when
>> attached to a hierarchy.
>>
>> This patch remove BFQ_WEIGHT_LEGACY_DFL and cpd_bind_fn().
>>
>> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> 
> For 1-3,
> 
> Acked-by: Tejun Heo <tj@kernel.org>
> 
> Thanks.
> 

Thanks, I will drop the last patch and send v2 with the tag.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-06 14:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28 14:56 [PATCH 1/4] block, bfq: remove BFQ_WEIGHT_LEGACY_DFL Chengming Zhou
2023-03-28 14:56 ` [PATCH 2/4] blk-cgroup: delete cpd_bind_fn of blkcg_policy Chengming Zhou
2023-03-28 14:57 ` [PATCH 3/4] blk-cgroup: delete cpd_init_fn " Chengming Zhou
2023-03-28 14:57 ` [PATCH 4/4] blk-cgroup: change BLKCG_MAX_POLS back to 5 Chengming Zhou
2023-03-29 18:59 ` [PATCH 1/4] block, bfq: remove BFQ_WEIGHT_LEGACY_DFL Tejun Heo
2023-04-06 14:34   ` Chengming Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).