lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 6 Jan 2023 15:50:09 +0800
From:   Hongchen Zhang <zhanghongchen@...ngson.cn>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Alexander Viro <viro@...iv.linux.org.uk>,
        Kuniyuki Iwashima <kuniyu@...zon.co.jp>,
        Luis Chamberlain <mcgrof@...nel.org>,
        David Howells <dhowells@...hat.com>,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Randy Dunlap <rdunlap@...radead.org>,
        Eric Dumazet <edumazet@...gle.com>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] pipe: use __pipe_{lock,unlock} instead of spinlock

Hi Andrew,
On 2023/1/6 am 10:59, Andrew Morton wrote:
> On Tue,  3 Jan 2023 14:33:03 +0800 Hongchen Zhang <zhanghongchen@...ngson.cn> wrote:
> 
>> Use spinlock in pipe_read/write cost too much time,IMO
>> pipe->{head,tail} can be protected by __pipe_{lock,unlock}.
>> On the other hand, we can use __pipe_lock/unlock to protect the
>> pipe->head/tail in pipe_resize_ring and post_one_notification.
> 
> Can you please test this with the test code in Linus's 0ddad21d3e99 and
> check that performance is good?
> 
I tested with the test code in Linus's 0ddad21d3e99,and get the 
following result:

1) before this patch
          13,136.54 msec task-clock           #    3.870 CPUs utilized 

          1,186,779      context-switches     #   90.342 K/sec 

            668,867      cpu-migrations       #   50.917 K/sec 

                895      page-faults          #   68.131 /sec 

     29,875,711,543      cycles               #    2.274 GHz 

     12,372,397,462      instructions         #    0.41  insn per cycle 

      2,480,235,723      branches             #  188.804 M/sec 

         47,191,943      branch-misses        #    1.90% of all branches 


        3.394806886 seconds time elapsed

        0.037869000 seconds user
        0.189346000 seconds sys

2) after this patch

          12,395.63 msec task-clock          #    4.138 CPUs utilized 

          1,193,381      context-switches    #   96.274 K/sec 

            585,543      cpu-migrations      #   47.238 K/sec 

              1,063      page-faults         #   85.756 /sec 

     27,691,587,226      cycles              #    2.234 GHz 

     11,738,307,999      instructions        #    0.42  insn per cycle 

      2,351,299,522      branches            #  189.688 M/sec 

         45,404,526      branch-misses       #    1.93% of all branches 


        2.995280878 seconds time elapsed

        0.010615000 seconds user
        0.206999000 seconds sys
After adding this patch, the time used on this test program becomes less.

Another thing, because of my carelessness, trinity tool tested a bug, I
will remove the unnecessary __pipe_{lock,unlock} in pipe_resize_ring in 
v3, because the lock is owned in pipe_fcntl/pipe_ioctl.

Thanks.



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ