block: cleanup cgroup
Subsystems (3)
cover block: cleanup cgroup
Hello,
The 1st two patches cleans up blk-cgroup code a bit.
The 3rd patch moves block layer internal definition into one private header of block/blk-cgroup.h, as suggested by Christoph, and the idea is that just small amount of structures & functions need to be exported, and most of them are block layer internal structures and functions.
Ming Lei (3):
block: remove THROTL_IOPS_MAX
block: move initialization of q->blkg_list into blkcg_init_queue
block: partition include/linux/blk-cgroup.h
block/bfq-iosched.h | 1 - block/bio.c | 2 +- block/blk-cgroup-rwstat.h | 2 +- block/blk-cgroup.c | 4 +- block/blk-cgroup.h | 477 ++++++++++++++++++++++++++++++++++++ block/blk-core.c | 5 +- block/blk-crypto-fallback.c | 2 +- block/blk-iocost.c | 2 +- block/blk-iolatency.c | 2 +- block/blk-ioprio.c | 2 +- block/blk-sysfs.c | 2 +- block/blk-throttle.c | 1 - block/bounce.c | 2 +- block/elevator.c | 2 +- include/linux/blk-cgroup.h | 461 +--------------------------------- 15 files changed, 495 insertions(+), 472 deletions(-) create mode 100644 block/blk-cgroup.h
Signature · 1 line
2.31.1
PATCH 1/3 block: remove THROTL_IOPS_MAX
No one uses THROTL_IOPS_MAX any more, so remove it.
--- include/linux/blk-cgroup.h | 2 -- 1 file changed, 2 deletions(-)
include/linux/blk-cgroup.h +0 -2
@@ -28,8 +28,6 @@/* percpu_counter batch for blkg_[rw]stats, per-cpu drift doesn't matter */ #define BLKG_STAT_CPU_BATCH (INT_MAX / 2) -/* Max limits for throttle policy */ -#define THROTL_IOPS_MAX UINT_MAX#define FC_APPID_LEN 129
Signature · 1 line
2.31.1
Re: [PATCH 1/3] block: remove THROTL_IOPS_MAX
Looks good:
PATCH 2/3 block: move initialization of q->blkg_list into blkcg_init_queue
In reply to Ming Leiq->blkg_list is only used by blkcg code, so move it into blkcg_init_queue.
--- block/blk-cgroup.c | 2 ++ block/blk-core.c | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-)
block/blk-cgroup.c +2 -0
@@ -1175,6 +1175,8 @@ int blkcg_init_queue(struct request_queue *q)bool preloaded;int ret; +INIT_LIST_HEAD (&q->blkg_list); + new_blkg =blkg_alloc (&blkcg_root, q,GFP_KERNEL );if (!new_blkg)return -ENOMEM ;
block/blk-core.c +0 -3
@@ -476,9 +476,6 @@ struct request_queue *blk_alloc_queue(int node_id, bool alloc_srcu)timer_setup (&q->timeout, blk_rq_timed_out_timer,0 );INIT_WORK (&q->timeout_work, blk_timeout_work);INIT_LIST_HEAD (&q->icq_list); -#ifdef CONFIG_BLK_CGROUP -INIT_LIST_HEAD (&q->blkg_list); -#endif kobject_init (&q->kobj, &blk_queue_ktype);
Signature · 1 line
2.31.1
PATCH 3/3 block: partition include/linux/blk-cgroup.h
In reply to Ming LeiPartition include/linux/blk-cgroup.h into two parts: one is public part, the other is block layer private part.
Suggested by Christoph Hellwig.
--- block/bfq-iosched.h | 1 - block/bio.c | 2 +- block/blk-cgroup-rwstat.h | 2 +- block/blk-cgroup.c | 2 +- block/blk-cgroup.h | 477 ++++++++++++++++++++++++++++++++++++ block/blk-core.c | 2 +- block/blk-crypto-fallback.c | 2 +- block/blk-iocost.c | 2 +- block/blk-iolatency.c | 2 +- block/blk-ioprio.c | 2 +- block/blk-sysfs.c | 2 +- block/blk-throttle.c | 1 - block/bounce.c | 2 +- block/elevator.c | 2 +- include/linux/blk-cgroup.h | 459 +--------------------------------- 15 files changed, 493 insertions(+), 467 deletions(-) create mode 100644 block/blk-cgroup.h
block/bfq-iosched.h +0 -1
@@ -8,7 +8,6 @@#include <linux/blktrace_api.h> #include <linux/hrtimer.h> -#include <linux/blk-cgroup.h> #include "blk-cgroup-rwstat.h"
block/bio.c +1 -1
@@ -15,7 +15,6 @@#include <linux/mempool.h> #include <linux/workqueue.h> #include <linux/cgroup.h> -#include <linux/blk-cgroup.h> #include <linux/highmem.h> #include <linux/sched/sysctl.h> #include <linux/blk-crypto.h>
@@ -24,6 +23,7 @@#include <trace/events/block.h> #include "blk.h" #include "blk-rq-qos.h" +#include "blk-cgroup.h" struct bio_alloc_cache {struct bio *free_list;
block/blk-cgroup-rwstat.h +1 -1
@@ -6,7 +6,7 @@#ifndef _BLK_CGROUP_RWSTAT_H#define _BLK_CGROUP_RWSTAT_H -#include <linux/blk-cgroup.h> +#include "blk-cgroup.h" enum blkg_rwstat_type { BLKG_RWSTAT_READ,
block/blk-cgroup.c +1 -1
@@ -26,11 +26,11 @@#include <linux/delay.h> #include <linux/atomic.h> #include <linux/ctype.h> -#include <linux/blk-cgroup.h> #include <linux/tracehook.h> #include <linux/psi.h> #include <linux/part_stat.h> #include "blk.h" +#include "blk-cgroup.h" #include "blk-ioprio.h" #include "blk-throttle.h"
block/blk-cgroup.h new file +477 -0
477 lines not on this page · raw message
block/blk-core.c +1 -1
@@ -34,7 +34,6 @@#include <linux/delay.h> #include <linux/ratelimit.h> #include <linux/pm_runtime.h> -#include <linux/blk-cgroup.h> #include <linux/t10-pi.h> #include <linux/debugfs.h> #include <linux/bpf.h>
@@ -49,6 +48,7 @@#include "blk.h" #include "blk-mq-sched.h" #include "blk-pm.h" +#include "blk-cgroup.h" #include "blk-throttle.h" struct dentry *blk_debugfs_root;
block/blk-crypto-fallback.c +1 -1
@@ -10,7 +10,6 @@#define pr_fmt (fmt) "blk-crypto-fallback: " fmt#include <crypto/skcipher.h> -#include <linux/blk-cgroup.h> #include <linux/blk-crypto.h> #include <linux/blk-crypto-profile.h> #include <linux/blkdev.h>
@@ -20,6 +19,7 @@#include <linux/random.h> #include <linux/scatterlist.h> +#include "blk-cgroup.h" #include "blk-crypto-internal.h" static unsigned int num_prealloc_bounce_pg =32 ;
block/blk-iocost.c +1 -1
@@ -178,12 +178,12 @@#include <linux/time64.h> #include <linux/parser.h> #include <linux/sched/signal.h> -#include <linux/blk-cgroup.h> #include <asm/local.h> #include <asm/local64.h> #include "blk-rq-qos.h" #include "blk-stat.h" #include "blk-wbt.h" +#include "blk-cgroup.h" #ifdef CONFIG_TRACEPOINTS
block/blk-iolatency.c +1 -1
@@ -74,9 +74,9 @@#include <linux/sched/signal.h> #include <trace/events/block.h> #include <linux/blk-mq.h> -#include <linux/blk-cgroup.h> #include "blk-rq-qos.h" #include "blk-stat.h" +#include "blk-cgroup.h" #include "blk.h" #define DEFAULT_SCALE_COOKIE 1000000U
block/blk-ioprio.c +1 -1
@@ -12,11 +12,11 @@* Documentation/admin-guide/cgroup-v2.rst. */ -#include <linux/blk-cgroup.h> #include <linux/blk-mq.h> #include <linux/blk_types.h> #include <linux/kernel.h> #include <linux/module.h> +#include "blk-cgroup.h" #include "blk-ioprio.h" #include "blk-rq-qos.h"
block/blk-sysfs.c +1 -1
@@ -10,7 +10,6 @@#include <linux/backing-dev.h> #include <linux/blktrace_api.h> #include <linux/blk-mq.h> -#include <linux/blk-cgroup.h> #include <linux/debugfs.h> #include "blk.h"
@@ -18,6 +17,7 @@#include "blk-mq-debugfs.h" #include "blk-mq-sched.h" #include "blk-wbt.h" +#include "blk-cgroup.h" #include "blk-throttle.h" struct queue_sysfs_entry {
block/blk-throttle.c +0 -1
@@ -10,7 +10,6 @@#include <linux/blkdev.h> #include <linux/bio.h> #include <linux/blktrace_api.h> -#include <linux/blk-cgroup.h> #include "blk.h" #include "blk-cgroup-rwstat.h" #include "blk-stat.h"
block/bounce.c +1 -1
@@ -14,7 +14,6 @@#include <linux/pagemap.h> #include <linux/mempool.h> #include <linux/blkdev.h> -#include <linux/blk-cgroup.h> #include <linux/backing-dev.h> #include <linux/init.h> #include <linux/hash.h>
@@ -24,6 +23,7 @@#include <trace/events/block.h> #include "blk.h" +#include "blk-cgroup.h" #define POOL_SIZE 64#define ISA_POOL_SIZE 16
block/elevator.c +1 -1
@@ -35,7 +35,6 @@#include <linux/hash.h> #include <linux/uaccess.h> #include <linux/pm_runtime.h> -#include <linux/blk-cgroup.h> #include <trace/events/block.h>
@@ -44,6 +43,7 @@#include "blk-mq-sched.h" #include "blk-pm.h" #include "blk-wbt.h" +#include "blk-cgroup.h" static DEFINE_SPINLOCK (elv_list_lock);static LIST_HEAD (elv_list);
include/linux/blk-cgroup.h +5 -454
528 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH 3/3] block: partition include/linux/blk-cgroup.h
Quoted 2 lines · Ming Lei
Partition
include/linux/blk-cgroup.hinto two parts: one is public part, the other is block layer private part.
I'd say split instead of partition, but the actual patch looks good:
Quoted 8 lines · Ming Lei
The 1st two patches cleans up blk-cgroup code a bit.
The 3rd patch moves block layer internal definition into one private header of
block/blk-cgroup.h, as suggested by Christoph, and the idea is that just small amount of structures & functions need to be exported, and most of them are block layer internal structures and functions.[...]
Applied, thanks!
[1/3] block: remove THROTL_IOPS_MAX
commit: 0e51e2ab49a99bc5077760aa083dfa1c3bf9899b
[2/3] block: move initialization of q->blkg_list into blkcg_init_queue
commit: 472e4314c039d6cf36e28783b1c63f87b5b394c2
[3/3] block: partition include/linux/blk-cgroup.h
commit: 672fdcf0e7de3b1e39416ac85abf178f023271f1Best regards,
Signature · 1 line
Jens Axboe