From: Andrew Morton <akpm@linux-foundation.org>
To: Feng zhou <zhoufeng.zf@bytedance.com>
Cc: adobriyan@gmail.com, rppt@kernel.org,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
songmuchun@bytedance.com, zhouchengming@bytedance.com,
chenying.kernel@bytedance.com, zhengqi.arch@bytedance.com
Subject: Re: [PATCH] fs/proc/kcore.c: add mmap interface
Date: Wed, 26 May 2021 17:39:53 -0700 [thread overview]
Message-ID: <20210526173953.49fb3dc48c0f2a8b3c31fe2b@linux-foundation.org> (raw)
In-Reply-To: <20210526075142.9740-1-zhoufeng.zf@bytedance.com>
On Wed, 26 May 2021 15:51:42 +0800 Feng zhou <zhoufeng.zf@bytedance.com> wrote:
> From: ZHOUFENG <zhoufeng.zf@bytedance.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.
next prev parent reply other threads:[~2021-05-27 0:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-26 7:51 [PATCH] fs/proc/kcore.c: add mmap interface Feng zhou
2021-05-27 0:39 ` Andrew Morton [this message]
2021-05-27 6:37 ` [External] " zhoufeng
[not found] ` <d71a4ffa-f21e-62f5-7fa6-83ca14b3f05b@bytedance.com>
2021-05-27 22:30 ` Andrew Morton
2021-05-28 2:10 ` zhoufeng
2021-06-01 1:23 ` Andrew Morton
2021-06-01 2:57 ` [External] " zhoufeng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210526173953.49fb3dc48c0f2a8b3c31fe2b@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=adobriyan@gmail.com \
--cc=chenying.kernel@bytedance.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rppt@kernel.org \
--cc=songmuchun@bytedance.com \
--cc=zhengqi.arch@bytedance.com \
--cc=zhouchengming@bytedance.com \
--cc=zhoufeng.zf@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).