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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210526173953.49fb3dc48c0f2a8b3c31fe2b@linux-foundation.org>
Date:   Wed, 26 May 2021 17:39:53 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Feng zhou <zhoufeng.zf@...edance.com>
Cc:     adobriyan@...il.com, rppt@...nel.org, linux-kernel@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, songmuchun@...edance.com,
        zhouchengming@...edance.com, chenying.kernel@...edance.com,
        zhengqi.arch@...edance.com
Subject: Re: [PATCH] fs/proc/kcore.c: add mmap interface

On Wed, 26 May 2021 15:51:42 +0800 Feng zhou <zhoufeng.zf@...edance.com> wrote:

> From: ZHOUFENG <zhoufeng.zf@...edance.com>
> 
> When we do the kernel monitor, use the DRGN
> (https://github.com/osandov/drgn) access to kernel data structures,
> found that the system calls a lot. DRGN is implemented by reading
> /proc/kcore. After looking at the kcore code, it is found that kcore
> does not implement mmap, resulting in frequent context switching
> triggered by read. Therefore, we want to add mmap interface to optimize
> performance. Since vmalloc and module areas will change with allocation
> and release, consistency cannot be guaranteed, so mmap interface only
> maps KCORE_TEXT and KCORE_RAM.
> 
> The test results:
> 1. the default version of kcore
> real 11.00
> user 8.53
> sys 3.59
> 
> % time     seconds  usecs/call     calls    errors syscall
> ------ ----------- ----------- --------- --------- ----------------
> 99.64  128.578319          12  11168701           pread64
> ...
> ------ ----------- ----------- --------- --------- ----------------
> 100.00  129.042853              11193748       966 total
> 
> 2. added kcore for the mmap interface
> real 6.44
> user 7.32
> sys 0.24
> 
> % time     seconds  usecs/call     calls    errors syscall
> ------ ----------- ----------- --------- --------- ----------------
> 32.94    0.130120          24      5317       315 futex
> 11.66    0.046077          21      2231         1 lstat
>  9.23    0.036449         177       206           mmap
> ...
> ------ ----------- ----------- --------- --------- ----------------
> 100.00    0.395077                 25435       971 total
> 
> The test results show that the number of system calls and time
> consumption are significantly reduced.
> 

hm, OK, I guess why not.  The performance improvements for DRGN (which
appears to be useful) are nice and the code is simple.

I'm surprised that it makes this much difference.  Has DRGN been fully
optimised to minimise the amount of pread()ing which it does?  Why does
it do so much reading?

Thanks, I shall await input from others before moving ahead with this.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ