mbox series

[RFC,-next,0/7] blk-iocost: support to build iocost as kernel module

Message ID 20240613014937.1326020-1-yukuai1@huaweicloud.com (mailing list archive)
Headers show
Series blk-iocost: support to build iocost as kernel module | expand

Message

Yu Kuai June 13, 2024, 1:49 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com>

Yu Kuai (7):
  kernfs: export pr_cont_kernfs_path()
  cgroup: export cgroup_parse_float
  block: export some API
  blk-iocost: factor out helpers to handle params from ioc_qos_write()
  blk-iocost: parse params before initializing iocost
  blk-iocost: support to free iocost
  blk-iocost: support to build iocost as kernel module

 block/Kconfig             |   2 +-
 block/blk-cgroup.c        |   4 +
 block/blk-iocost.c        | 223 ++++++++++++++++++++++++++------------
 block/blk-rq-qos.c        |   2 +
 fs/kernfs/dir.c           |   1 +
 include/linux/blk_types.h |   2 +-
 kernel/cgroup/cgroup.c    |   1 +
 7 files changed, 163 insertions(+), 72 deletions(-)

Comments

Greg Kroah-Hartman June 13, 2024, 5:54 a.m. UTC | #1
On Thu, Jun 13, 2024 at 09:49:30AM +0800, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
> 
> Yu Kuai (7):
>   kernfs: export pr_cont_kernfs_path()
>   cgroup: export cgroup_parse_float
>   block: export some API
>   blk-iocost: factor out helpers to handle params from ioc_qos_write()
>   blk-iocost: parse params before initializing iocost
>   blk-iocost: support to free iocost
>   blk-iocost: support to build iocost as kernel module

No where do you say _why_ building this as a module is a good idea.

Why do this at all?

thanks,

greg k-h
Yu Kuai June 13, 2024, 6:53 a.m. UTC | #2
Hi,

在 2024/06/13 13:54, Greg KH 写道:
> On Thu, Jun 13, 2024 at 09:49:30AM +0800, Yu Kuai wrote:
>> From: Yu Kuai <yukuai3@huawei.com>
>>
>> Yu Kuai (7):
>>    kernfs: export pr_cont_kernfs_path()
>>    cgroup: export cgroup_parse_float
>>    block: export some API
>>    blk-iocost: factor out helpers to handle params from ioc_qos_write()
>>    blk-iocost: parse params before initializing iocost
>>    blk-iocost: support to free iocost
>>    blk-iocost: support to build iocost as kernel module
> 
> No where do you say _why_ building this as a module is a good idea.

Yes, we discussed this before and this is actually an general question.
Main advantages are:

- Flexibility and Maintainability, allows for dynamic loading and
unloading of modules at runtime without the need to recompile and
restart the kernel, for example fixing iocost CVE in our production
environment.

- Kernel Size and Resource Usage, modules are loaded only when their
specific functionality is required.

Thanks,
Kuai

> 
> Why do this at all?
> 
> thanks,
> 
> greg k-h
> 
> .
>
Bart Van Assche June 13, 2024, 4:15 p.m. UTC | #3
On 6/12/24 10:54 PM, Greg KH wrote:
> On Thu, Jun 13, 2024 at 09:49:30AM +0800, Yu Kuai wrote:
>> From: Yu Kuai <yukuai3@huawei.com>
>>
>> Yu Kuai (7):
>>    kernfs: export pr_cont_kernfs_path()
>>    cgroup: export cgroup_parse_float
>>    block: export some API
>>    blk-iocost: factor out helpers to handle params from ioc_qos_write()
>>    blk-iocost: parse params before initializing iocost
>>    blk-iocost: support to free iocost
>>    blk-iocost: support to build iocost as kernel module
> 
> No where do you say _why_ building this as a module is a good idea.
> 
> Why do this at all?

With CONFIG_BLK_CGROUP_IOCOST=y (as in the Android kernel), the
blk-iocost kernel module causes a (small) runtime overhead, even if it
is not being used.

Thanks,

Bart.
Yu Kuai June 14, 2024, 1:07 a.m. UTC | #4
Hi,

在 2024/06/14 0:15, Bart Van Assche 写道:
> On 6/12/24 10:54 PM, Greg KH wrote:
>> On Thu, Jun 13, 2024 at 09:49:30AM +0800, Yu Kuai wrote:
>>> From: Yu Kuai <yukuai3@huawei.com>
>>>
>>> Yu Kuai (7):
>>>    kernfs: export pr_cont_kernfs_path()
>>>    cgroup: export cgroup_parse_float
>>>    block: export some API
>>>    blk-iocost: factor out helpers to handle params from ioc_qos_write()
>>>    blk-iocost: parse params before initializing iocost
>>>    blk-iocost: support to free iocost
>>>    blk-iocost: support to build iocost as kernel module
>>
>> No where do you say _why_ building this as a module is a good idea.
>>
>> Why do this at all?
> 
> With CONFIG_BLK_CGROUP_IOCOST=y (as in the Android kernel), the
> blk-iocost kernel module causes a (small) runtime overhead, even if it
> is not being used.

I think this is not true... Because iocost is lazy initialized, and if
iocost is not initialized, there should not be such overhead.

Thanks,
Kuai

> 
> Thanks,
> 
> Bart.
> 
> 
> .
>
Christoph Hellwig June 14, 2024, 5:26 a.m. UTC | #5
This cover letter is a little, erm, sparse.

Please explain why you want iocost as a module.  This adds a whole
lot of infrastructure for no obvious reason.