[PATCH 0/4] proc/kcore: performance optimizations

Omar Sandoval posted 4 patches 2 weeks ago
MAINTAINERS     |  7 +++++
fs/proc/kcore.c | 81 +++++++++++++++++++++++++------------------------
2 files changed, 48 insertions(+), 40 deletions(-)
[PATCH 0/4] proc/kcore: performance optimizations
Posted by Omar Sandoval 2 weeks ago
From: Omar Sandoval <osandov@fb.com>

Hi,

The performance of /proc/kcore reads has been showing up as a bottleneck
for drgn. drgn scripts often spend ~25% of their time in the kernel
reading from /proc/kcore.

A lot of this overhead comes from silly inefficiencies. This patch
series fixes the low-hanging fruit. The fixes are all fairly small and
straightforward. The result is a 25% improvement in read latency in
micro-benchmarks (from ~235 nanoseconds to ~175) and a 15% improvement
in execution time for real-world drgn scripts.

Since I have a stake in /proc/kcore and have modified it several times,
the final patch volunteers me to maintain it.

Thanks,
Omar

Omar Sandoval (4):
  proc/kcore: mark proc entry as permanent
  proc/kcore: don't walk list on every read
  proc/kcore: use percpu_rw_semaphore for kclist_lock
  MAINTAINERS: add me as /proc/kcore maintainer

 MAINTAINERS     |  7 +++++
 fs/proc/kcore.c | 81 +++++++++++++++++++++++++------------------------
 2 files changed, 48 insertions(+), 40 deletions(-)

-- 
2.47.0
Re: [PATCH 0/4] proc/kcore: performance optimizations
Posted by Christian Brauner 1 week, 5 days ago
On Fri, 08 Nov 2024 17:28:38 -0800, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> Hi,
> 
> The performance of /proc/kcore reads has been showing up as a bottleneck
> for drgn. drgn scripts often spend ~25% of their time in the kernel
> reading from /proc/kcore.
> 
> [...]

A bit too late for v6.13, I think but certainly something we can look at
for v6.14. And great that your stepping up to maintain it!

---

Applied to the vfs-6.14.kcore branch of the vfs/vfs.git tree.
Patches in the vfs-6.14.kcore branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.14.kcore

[1/4] proc/kcore: mark proc entry as permanent
      https://git.kernel.org/vfs/vfs/c/182e1391e525
[2/4] proc/kcore: don't walk list on every read
      https://git.kernel.org/vfs/vfs/c/7d528645beeb
[3/4] proc/kcore: use percpu_rw_semaphore for kclist_lock
      https://git.kernel.org/vfs/vfs/c/61c85db61fad
[4/4] MAINTAINERS: add me as /proc/kcore maintainer
      https://git.kernel.org/vfs/vfs/c/f792a4899395
Re: [PATCH 0/4] proc/kcore: performance optimizations
Posted by Omar Sandoval 1 week, 5 days ago
On Mon, Nov 11, 2024 at 10:00:54AM +0100, Christian Brauner wrote:
> On Fri, 08 Nov 2024 17:28:38 -0800, Omar Sandoval wrote:
> > From: Omar Sandoval <osandov@fb.com>
> > 
> > Hi,
> > 
> > The performance of /proc/kcore reads has been showing up as a bottleneck
> > for drgn. drgn scripts often spend ~25% of their time in the kernel
> > reading from /proc/kcore.
> > 
> > [...]
> 
> A bit too late for v6.13, I think but certainly something we can look at
> for v6.14. And great that your stepping up to maintain it!

Thanks, v6.14 is totally fine!

I have a quick question on logistics. /proc/kcore typically only gets a
handful of patches per cycle, if any, so should we add fsdevel to the
MAINTAINERS entry so I can ask you to queue up patches in the vfs tree
once I've reviewed them? Or should I send pull requests somewhere?

Thanks,
Omar
Re: [PATCH 0/4] proc/kcore: performance optimizations
Posted by Christian Brauner 1 week, 4 days ago
On Mon, Nov 11, 2024 at 10:08:39AM -0800, Omar Sandoval wrote:
> On Mon, Nov 11, 2024 at 10:00:54AM +0100, Christian Brauner wrote:
> > On Fri, 08 Nov 2024 17:28:38 -0800, Omar Sandoval wrote:
> > > From: Omar Sandoval <osandov@fb.com>
> > > 
> > > Hi,
> > > 
> > > The performance of /proc/kcore reads has been showing up as a bottleneck
> > > for drgn. drgn scripts often spend ~25% of their time in the kernel
> > > reading from /proc/kcore.
> > > 
> > > [...]
> > 
> > A bit too late for v6.13, I think but certainly something we can look at
> > for v6.14. And great that your stepping up to maintain it!
> 
> Thanks, v6.14 is totally fine!
> 
> I have a quick question on logistics. /proc/kcore typically only gets a
> handful of patches per cycle, if any, so should we add fsdevel to the
> MAINTAINERS entry so I can ask you to queue up patches in the vfs tree
> once I've reviewed them? Or should I send pull requests somewhere?

You can do that as you please. I can just pick them up once you've acked
them. I'm happy to do that.