From: Peter Xu <peterx@redhat.com>
To: Daniil Tatianin <d-tatianin@yandex-team.ru>
Cc: Paolo Bonzini <pbonzini@redhat.com>, Stefan Weil <sw@weilnetz.de>,
Fabiano Rosas <farosas@suse.de>,
qemu-devel@nongnu.org
Subject: Re: [PATCH 0/2] overcommit: introduce mem-lock-onfault
Date: Tue, 10 Dec 2024 12:20:29 -0500 [thread overview]
Message-ID: <Z1h4XaKCwfidJLfw@x1n> (raw)
In-Reply-To: <ddd20bd5-2596-4966-a77f-fb44b651dc6a@yandex-team.ru>
On Tue, Dec 10, 2024 at 08:01:08PM +0300, Daniil Tatianin wrote:
> I mentioned my use case in the cover letter. Basically we want to protect
> QEMU's pages from being migrated and compacted by kcompactd, which it
> accomplishes by modifying live page tables and spamming the process with TLB
> invalidate IPIs while it does that, which kills guest performance for the
> duration of the compaction operation.
Ah right, I read it initially but just now when I scanned the cover letter
I missed that. My fault.
>
> Memory locking allows to protect a process from kcompactd page compaction
> and more importantly, migration (that is taking a PTE and replacing it with
> one, which is closer in memory to reduce fragmentation). (As long as
> /proc/sys/vm/compact_unevictable_allowed is 0)
>
> For this use case we don't mind page faults as they take more or less
> constant time, which we can also avoid if we wanted by preallocating guest
> memory. We do, however, want PTEs to be untouched by kcompactd, which
> MCL_ONFAULT accomplishes just fine without the extra memory overhead that
> comes from various anonymous mappings getting write-faulted with the
> currently available mem-lock=on option.
>
> In our case we use KVM of course, TCG was just an experiment where I noticed
> anonymous memory
> jump way too much.
>
> I don't think it's feasible in our case to look for the origin of every
> anonymous mapping that grew compared to the no mem-lock case (which there's
> about ~30 with default Q35 + KVM, without any extra devices), and try to
> optimize it to map anonymous memory less eagerly.
Would it be better then to use mem-lock=on|off|onfault? So turns it into a
string to avoid the "exclusiveness" needed (meanwhile having two separate
knobs for relevant things looks odd too).
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2024-12-10 17:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 23:19 [PATCH 0/2] overcommit: introduce mem-lock-onfault Daniil Tatianin
2024-12-05 23:19 ` [PATCH 1/2] os: add an ability to lock memory on_fault Daniil Tatianin
2024-12-05 23:19 ` [PATCH 2/2] overcommit: introduce mem-lock-onfault Daniil Tatianin
2024-12-06 1:08 ` [PATCH 0/2] " Peter Xu
2024-12-09 7:40 ` Daniil Tatianin
2024-12-10 16:48 ` Peter Xu
2024-12-10 17:01 ` Daniil Tatianin
2024-12-10 17:20 ` Peter Xu [this message]
2024-12-10 17:23 ` Daniil Tatianin
2024-12-10 14:48 ` Vladimir Sementsov-Ogievskiy
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=Z1h4XaKCwfidJLfw@x1n \
--to=peterx@redhat.com \
--cc=d-tatianin@yandex-team.ru \
--cc=farosas@suse.de \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.