Re: [PATCH blktests 1/5] tests/throtl: add first test for blk-throttle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/15/24 20:17, Yu Kuai wrote:
> Hi,
>
> 在 2024/04/16 11:02, Chaitanya Kulkarni 写道:
>> On 4/15/24 19:00, Yu Kuai wrote:
>>> From: Yu Kuai <yukuai3@xxxxxxxxxx>
>>>
>>> Test basic functionality.
>>>
>>> Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx>
>>> ---
>>>    tests/throtl/001     | 84 
>>> ++++++++++++++++++++++++++++++++++++++++++++
>>>    tests/throtl/001.out |  6 ++++
>>>    tests/throtl/rc      | 15 ++++++++
>>>    3 files changed, 105 insertions(+)
>>>    create mode 100755 tests/throtl/001
>>>    create mode 100644 tests/throtl/001.out
>>>    create mode 100644 tests/throtl/rc
>>>
>>> diff --git a/tests/throtl/001 b/tests/throtl/001
>>> new file mode 100755
>>> index 0000000..79ecf07
>>> --- /dev/null
>>> +++ b/tests/throtl/001
>>> @@ -0,0 +1,84 @@
>>> +#!/bin/bash
>>> +# SPDX-License-Identifier: GPL-3.0+
>>> +# Copyright (C) 2024 Yu Kuai
>>> +#
>>> +# Test basic functionality of blk-throttle
>>> +
>>> +. tests/throtl/rc
>>> +
>>> +DESCRIPTION="basic functionality"
>>> +QUICK=1
>>> +
>>> +CG=/sys/fs/cgroup
>>> +TEST_DIR=$CG/blktests_throtl
>>> +devname=nullb0
>>> +dev=""
>>> +
>>> +set_up_test() {
>>> +    if ! _init_null_blk nr_devices=1; then
>>> +        return 1;
>>> +    fi
>>> +
>>> +    dev=$(cat /sys/block/$devname/dev)
>>> +    echo +io > $CG/cgroup.subtree_control
>>> +    mkdir $TEST_DIR
>>> +
>>
>> move above to 3 lines to rc with helper instead of repeating the
>> code for every test ?
>
> Yes, that sounds good, just test 004 is different.

indeed, but for future tests we are going need that anyways ..

>>
>>> +    return 0;
>>> +}
>>> +
>>> +clean_up_test() {
>>> +    rmdir $TEST_DIR
>>> +    echo -io > $CG/cgroup.subtree_control
>>> +    _exit_null_blk
>>
>> same here ?
>>
>>> +}
>>> +
>>> +config_throtl() {
>>> +    echo "$dev $*" > $TEST_DIR/io.max
>>> +}
>>> +
>>> +remove_config() {
>>> +    echo "$dev rbps=max wbps=max riops=max wiops=max" > 
>>> $TEST_DIR/io.max
>>> +}
>>> +
>>
>> same here for above two helper ?
>
> Yes, of course.
>>
>>> +test_io() {
>>> +    config_throtl "$1"
>>> +
>>> +    {
>>> +        sleep 0.1
>>> +        start_time=$(date +%s.%N)
>>> +
>>> +        if [ "$2" == "read" ]; then
>>> +            dd if=/dev/$devname of=/dev/null bs=4k count=256 
>>> iflag=direct status=none
>>> +        elif [ "$2" == "write" ]; then
>>> +            dd of=/dev/$devname if=/dev/zero bs=4k count=256 
>>> oflag=direct status=none
>>> +        fi
>>
>> Is there a any specific reason to use dd and not fio ?
>
> My thoughts is that I need to make sure the number and the size
> of IO that I dispatched, so that I can predict the throttle time,
> and we don't need to keep issuing new IO based on time here.

I believe we can do that with fio too, no ? the reason I'm asking
with fio we can specify io_engine and I believe we shuold
be using io_uring in general ? but then for such small I/Os it
may not matter so we can keep it as is ... I'll leave it to you ..

-ck






[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux