From: David Hildenbrand <david@redhat.com>
To: Daniil Tatianin <d-tatianin@yandex-team.ru>, qemu-devel@nongnu.org
Cc: imammedo@redhat.com, pbonzini@redhat.com, yc-core@yandex-team.ru,
sw@weilnetz.de
Subject: Re: [PATCH v1 2/2] osdep: support mempolicy for preallocation in os_mem_prealloc
Date: Tue, 7 Dec 2021 09:13:06 +0100 [thread overview]
Message-ID: <3af46862-7c8d-dcdd-9ca8-8ace4f3a554a@redhat.com> (raw)
In-Reply-To: <20211207070607.1422670-2-d-tatianin@yandex-team.ru>
On 07.12.21 08:06, Daniil Tatianin wrote:
> This is needed for cases where we want to make sure that a shared memory
> region gets allocated from a specific NUMA node. This is impossible to do
> with mbind(2) because it ignores the policy for memory mapped with
> MAP_SHARED. We work around this by calling set_mempolicy from prealloc
> threads instead.
That's not quite true I think, how were you able to observe this? Do you
have a reproducer?
While the man page says:
"
The specified policy will be ignored for any MAP_SHARED mappings in
the specified memory range. Rather the pages will be allocated
according to the memory policy of the thread that caused the page to be
allocated. Again, this may not be the thread that called mbind().
"
What it really means is that as long as we access that memory via the
*VMA* for which we called mbind(), which is the case when *not* using
fallocate() to preallocate memory, we end up using the correct policy.
I did experiments a while ago with hugetlbfs shared memory and it
properly allocated from the right node. So I'd be curious how you
trigger this.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2021-12-07 8:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-07 7:06 [PATCH v1 1/2] hostmem: use a static size for maxnode, validate policy everywhere Daniil Tatianin
2021-12-07 7:06 ` [PATCH v1 2/2] osdep: support mempolicy for preallocation in os_mem_prealloc Daniil Tatianin
2021-12-07 8:13 ` David Hildenbrand [this message]
[not found] ` <227321638883575@mail.yandex-team.ru>
2021-12-07 15:05 ` David Hildenbrand
2021-12-07 8:31 ` [PATCH v1 1/2] hostmem: use a static size for maxnode, validate policy everywhere David Hildenbrand
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=3af46862-7c8d-dcdd-9ca8-8ace4f3a554a@redhat.com \
--to=david@redhat.com \
--cc=d-tatianin@yandex-team.ru \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
--cc=yc-core@yandex-team.ru \
/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).