Re: generic/478: why eval is so fast?

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



On Fri, Jun 30, 2023 at 02:50:47PM +0500, stsp wrote:
> Hi guys.
> 
> While playing with the test 478, I've
> noticed something very strange. Namely,
> this small patch, that only adds eval to
> the script:
> 
> diff --git a/tests/generic/478 b/tests/generic/478
> index 480762d2..45b801d0 100755
> --- a/tests/generic/478
> +++ b/tests/generic/478
> @@ -106,24 +106,24 @@ do_test()
>         # print options and getlk output for debug
>         echo $* >> $seqres.full 2>&1
>         # -s : do setlk
> -       $here/src/t_ofd_locks $soptions $TEST_DIR/testfile &
> +       eval $here/src/t_ofd_locks $soptions $TEST_DIR/testfile &
>         # -g : do getlk
> -       $here/src/t_ofd_locks $goptions $TEST_DIR/testfile | \
> +       eval $here/src/t_ofd_locks $goptions $TEST_DIR/testfile | \
>                 tee -a $seqres.full
>         wait $!

I didn't find out why it run faster, but I'm sure we can't merge a
patch which only say "it's faster, but don't know why". Especially
that "faster" is really unnormal.

One thing I'm confused is about that background process, if you add eval to
that line, can you sure the later "$!" (in "wait $!") is the t_ofd_locks
process number?

The second eval with "| tee -a  $seqres.full" confused me too, I'm not
so familar with eval, can't what kind of problem it brings in, but I
doubt something wrong at there.

Anyway, I can't merge a patch like this. But I don't mind if anyone
can answer this question :)

Thanks,
Zorro

> 
>         # add -F to clone with CLONE_FILES
>         soptions="$1 -F"
>         # with -F, new locks are always file to place
> -       $here/src/t_ofd_locks $soptions $TEST_DIR/testfile &
> -       $here/src/t_ofd_locks $goptions $TEST_DIR/testfile | \
> +       eval $here/src/t_ofd_locks $soptions $TEST_DIR/testfile &
> +       eval $here/src/t_ofd_locks $goptions $TEST_DIR/testfile | \
>                 tee -a $seqres.full
>         wait $!
> 
>         # add -d to dup and close
>         soptions="$1 -d"
> -       $here/src/t_ofd_locks $soptions $TEST_DIR/testfile &
> -       $here/src/t_ofd_locks $goptions $TEST_DIR/testfile | \
> +       eval $here/src/t_ofd_locks $soptions $TEST_DIR/testfile &
> +       eval $here/src/t_ofd_locks $goptions $TEST_DIR/testfile | \
>                 tee -a $seqres.full
>         wait $!
>  }
> 
> 
> speeds up the test by 50-60%!
> This is quite unbelievable, and probably
> means such change breaks something.
> But I have no idea what and how.
> Can anyone come up with a good guess?
> 




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux