linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilker Yaz <ilkeryaz@gmail.com>
To: viro@zeniv.linux.org.uk, brauner@kernel.org
Cc: linux-fsdevel@vger.kernel.org
Subject: A few million negative dentries causes CPU regression for open() sys calls
Date: Thu, 11 Jul 2024 17:09:15 -0700	[thread overview]
Message-ID: <CAMBmcmkbuB6UGxSMqLiaO_Xk5YwJmmhcZHJEggktjf9RGejTag@mail.gmail.com> (raw)

Hi all,
I've been investigating why system (kernel-mode) CPU usage of our
hosts keeps climbing up over time (over several weeks).
I realized it can be remedied by dropping cache w:
  $ echo 2 > /proc/sys/vm/drop_caches
which significantly reduces the system CPU usage like below w/o any
other change:
https://photos.app.goo.gl/aYQmi5v6qnThbt8S7

I was able to repro the same by running:
  $ stress-ng -o 10
to generate open() sys calls, and later by opening non-existent files
to increase negative dentry count to ~8.6 million:
  $ cat /proc/sys/fs/dentry-state
  11039972    10987061    45    0    8615033    0

Before stress-ng was consuming 20% system CPU (negative dentry count
was around 2 million) and after it started to consume +40% (w/ 8.6
million).
https://photos.app.goo.gl/xc3m5fwZdbqgbdaM7


I tried the same on another host by increasing regular dentry count to
~80 million by iterating over existing files. There was no regression.
Why would negative dentries have such a profound impact on open() sys
call performance?

Linux version:
  $ uname -r
  5.14.0-284.11.1.el9_2.x86_64

Thanks!

P.S. I've perf top / perf record / flamegraphs if needed.

                 reply	other threads:[~2024-07-12  0:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CAMBmcmkbuB6UGxSMqLiaO_Xk5YwJmmhcZHJEggktjf9RGejTag@mail.gmail.com \
    --to=ilkeryaz@gmail.com \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).