From: Thomas Bertschinger <tahbertschinger@gmail.com>
To: linux-bcachefs@vger.kernel.org
Subject: bcachefs CLI: question on use of mlockall()
Date: Mon, 18 Dec 2023 21:07:47 -0700 [thread overview]
Message-ID: <20231219040747.GB251273@fedora> (raw)
The mlockall(MCL_FUTURE) call at the beginning of the bcachefs CLI
tool seems problematic in some cases. When running commands as an
unprivileged user with the default mlock limit (8 MiB), it can cause
ENOMEM failures, for example:
$ ulimit -l
8192
$ fallocate -l $((1024 ** 3)) test-image
$ bcachefs format test-image
...
error opening test-img: ENOMEM_fs_other_alloc
While this can be worked around by running the bcachefs utility as
root, or by raising the default limit, I think commands like this
should work for unprivileged users under a common default configuration.
I wonder if the mlockall() can be targeted to the scenarios where it's
really needed, instead of applying to every bcachefs command? Some
ideas on how to target it:
- only call it if running as root
- check that getrlimit(RLIMIT_MEMLOCK, ...) is at a "high enough" value
first
- or, only call it for subcommands that actually need it
Any thoughts / comments? Would a better, or complementary approach, be
to reduce the amount of memory mapped for operations like 'format'?
Thanks!
- Thomas Bertschinger
next reply other threads:[~2023-12-19 4:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-19 4:07 Thomas Bertschinger [this message]
2023-12-19 4:17 ` bcachefs CLI: question on use of mlockall() Kent Overstreet
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=20231219040747.GB251273@fedora \
--to=tahbertschinger@gmail.com \
--cc=linux-bcachefs@vger.kernel.org \
/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