public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Ivan Shapovalov <intelfx@intelfx.name>
To: Filipe Manana <fdmanana@kernel.org>
Cc: "Jannik Glückert" <jannik.glueckert@gmail.com>,
	andrea.gelmini@gmail.com, dsterba@suse.com, josef@toxicpanda.com,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	mikhail.v.gavrilov@gmail.com, regressions@lists.linux.dev
Subject: Re: 6.10/regression/bisected - after f1d97e769152 I spotted increased execution time of the kswapd0 process and symptoms as if there is not enough memory
Date: Fri, 16 Aug 2024 13:16:19 +0200	[thread overview]
Message-ID: <c876143d683d356a1c657455e295525f18e08895.camel@intelfx.name> (raw)
In-Reply-To: <CAL3q7H7-04s=j0fwGRx-TxGeP2-7ZeZ5Kdeo2fYdDFLE9ijupA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4004 bytes --]

On 2024-08-16 at 11:58 +0100, Filipe Manana wrote:
> On Fri, Aug 16, 2024 at 12:17 AM <intelfx@intelfx.name> wrote:
> > 
> > On 2024-08-16 at 00:21 +0200, intelfx@intelfx.name wrote:
> > > On 2024-08-11 at 16:33 +0100, Filipe Manana wrote:
> > > > <...>
> > > > This came to my attention a couple days ago in a bugzilla report here:
> > > > 
> > > > https://bugzilla.kernel.org/show_bug.cgi?id=219121
> > > > 
> > > > There's also 2 other recent threads in the mailing about it.
> > > > 
> > > > There's a fix there in the bugzilla, and I've just sent it to the mailing list.
> > > > In case you want to try it:
> > > > 
> > > > https://lore.kernel.org/linux-btrfs/d85d72b968a1f7b8538c581eeb8f5baa973dfc95.1723377230.git.fdmanana@suse.com/
> > > > 
> > > > Thanks.
> > > 
> > > Hello,
> > > 
> > > I confirm that excessive "system" CPU usage by kswapd and btrfs-cleaner
> > > kernel threads is still happening on the latest 6.10 stable with all
> > > quoted patches applied, making the system close to unusable (not to
> > > mention excessive power usage which crosses the line well *into*
> > > "unusable" for low-power systems such as laptops).
> > > 
> > > With just 5 minutes of uptime on a freshly booted 6.10.5 system, the
> > > cumulative CPU time of kswapd is already at 2 minutes.
> 
> Less than 24 hours before your message, there was a patch merged to
> Linus' tree, which was not (and is not) yet in any stable release
> (including 6.10.5 of course).
> Have you tried that patch?

Yes, I did — as I said, I tried 6.10.5 with all combinations of patches
ever posted in this thread (skipping those that I was not able to
apply; it seems that there were a few mutually incompatible attempts to
improve the extent map shrinker, some of which have already gone into
the stable tree, thus making others inapplicable).

> > As a follow-up, after 1 hour of uptime of this system the total CPU
> > time of kswapd0 is exactly 30 minutes. So whatever is the theoretical
> > OOM issue that the extent map shrinker is trying to solve, the solution
> 
> It's not a theoretical problem.
> It's a problem that any unprivileged user can trigger provided that
> the amount of available disk space is much higher than total RAM,
> which is by far the most common case.
> 
> The problem is explained in the commit change log, there's a
> reproducer and it was even reported by a user:
> 
> https://lore.kernel.org/linux-btrfs/13f94633dcf04d29aaf1f0a43d42c55e@amazon.com/
> 
> This link was included in the changelog of the patch when submitted to
> the list [1], but somehow it disappeared when it was merged to the git
> repository.
> 
> Any user can effectively trigger a denial of service by creating an
> unlimited number of extent maps that never get removed while it keeps
> a file descriptor open and doing writes, either with direct IO, which
> is simpler, or even buffered IO in case it creates holes in the files
> (example: keep doing append writes starting after current eof, to
> create a bunch of holes). Even if that task doing that gets killed by
> the OOM, as long as there are idle processes keeping the file open,
> the problem doesn't go away.

Sorry, I did not intend to sound dismissive — what I wanted to say was
that we fixed an edge case (and yes, I acknowledge that this edge case
could be a security problem) by instead pessimizing a common case.

-- 
Ivan Shapovalov / intelfx /

> [1] https://lore.kernel.org/linux-btrfs/1cb649870b6cad4411da7998735ab1141bb9f2f0.1712837044.git.fdmanana@suse.com/
> 
> > in its current form is clearly unacceptable.
> > 
> > Can we please have it reverted on the basis of this severe regression,
> > until a better solution is found?
> 
> Disabling the shrinker might be the best for now. I'm on vacation and
> can't write and test code, but I do have plans for making it better
> and solving any remaining issues.
> There's already a patch for that from Qu.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 862 bytes --]

  reply	other threads:[~2024-08-16 11:16 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 20:56 6.10/regression/bisected - after f1d97e769152 I spotted increased execution time of the kswapd0 process and symptoms as if there is not enough memory Mikhail Gavrilov
2024-06-26 10:48 ` Filipe Manana
2024-06-26 14:16   ` Mikhail Gavrilov
2024-07-01  9:30     ` Filipe Manana
2024-07-02 14:13       ` Mikhail Gavrilov
2024-07-02 17:22         ` Filipe Manana
2024-07-02 19:46           ` Chris Murphy
2024-07-03 10:32             ` Filipe Manana
2024-07-03 10:31           ` Filipe Manana
2024-07-03 10:44             ` Filipe Manana
2024-07-03 21:07               ` Andrea Gelmini
2024-07-04  9:48                 ` Filipe Manana
2024-07-04  9:56                   ` Filipe Manana
2024-07-04 10:50                     ` Mikhail Gavrilov
2024-07-04 13:33                     ` Andrea Gelmini
2024-07-04 13:47                       ` Andrea Gelmini
2024-07-04 14:48                         ` Andrea Gelmini
2024-07-04 17:25                           ` Filipe Manana
2024-07-04 17:31                             ` Filipe Manana
2024-07-04 22:15                             ` Andrea Gelmini
2024-07-04 22:23                               ` Andrea Gelmini
2024-07-05 11:00                               ` Filipe Manana
2024-07-05  6:30                             ` Andrea Gelmini
2024-07-05 11:06                               ` Filipe Manana
2024-07-05 18:36                             ` Mikhail Gavrilov
2024-07-05 23:09                               ` Filipe Manana
2024-07-06  0:11                             ` Andrea Gelmini
2024-07-06 12:07                               ` Andrea Gelmini
2024-07-06 17:37                                 ` Filipe Manana
2024-07-07  9:41                                   ` Filipe Manana
2024-07-07 10:15                                     ` Andrea Gelmini
2024-07-07 10:28                                       ` Filipe Manana
2024-07-07 11:15                                         ` Andrea Gelmini
2024-07-07 12:10                                           ` Filipe Manana
2024-07-07 11:35                                   ` Mikhail Gavrilov
2024-07-07 12:15                                     ` Filipe Manana
2024-07-07 19:16                                       ` Mikhail Gavrilov
2024-07-08 14:15                                         ` Filipe Manana
2024-07-10  9:24                                           ` Mikhail Gavrilov
2024-07-10 10:53                                             ` Filipe Manana
2024-08-11  8:08                                               ` Jannik Glückert
2024-08-11 15:33                                                 ` Filipe Manana
2024-08-14 21:24                                                   ` Jannik Glückert
2024-08-15 22:21                                                   ` intelfx
2024-08-15 23:17                                                     ` intelfx
2024-08-16  0:02                                                       ` David Sterba
2024-08-16  6:42                                                       ` Andrea Gelmini
2024-08-16  6:47                                                         ` Ivan Shapovalov
2024-08-16  7:45                                                           ` Qu Wenruo
2024-08-16 10:58                                                       ` Filipe Manana
2024-08-16 11:16                                                         ` Ivan Shapovalov [this message]
2024-09-26 13:45                                                           ` Filipe Manana
2024-07-04 11:18                   ` Andrea Gelmini
2024-07-04 16:38                     ` Filipe Manana
2024-07-04 22:32                       ` Qu Wenruo
2024-07-05  6:18                         ` Andrea Gelmini

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=c876143d683d356a1c657455e295525f18e08895.camel@intelfx.name \
    --to=intelfx@intelfx.name \
    --cc=andrea.gelmini@gmail.com \
    --cc=dsterba@suse.com \
    --cc=fdmanana@kernel.org \
    --cc=jannik.glueckert@gmail.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikhail.v.gavrilov@gmail.com \
    --cc=regressions@lists.linux.dev \
    /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