All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "Michal Prívozník" <mprivozn@redhat.com>, qemu-devel@nongnu.org
Cc: imammedo@redhat.com, marcandre.lureau@redhat.com, berrange@redhat.com
Subject: Re: [PATCH v2] hostmem: Honor multiple preferred nodes if possible
Date: Mon, 19 Dec 2022 10:55:39 +0100	[thread overview]
Message-ID: <536107c6-b142-d5aa-0d94-4277a5c5af15@redhat.com> (raw)
In-Reply-To: <c7fc7797-6696-e9d8-8c1a-dd4b86cc2781@redhat.com>

On 16.12.22 14:47, Michal Prívozník wrote:
> On 12/16/22 14:41, David Hildenbrand wrote:
>> On 15.12.22 10:55, Michal Privoznik wrote:
>>> If a memory-backend is configured with mode
>>> HOST_MEM_POLICY_PREFERRED then
>>> host_memory_backend_memory_complete() calls mbind() as:
>>>
>>>     mbind(..., MPOL_PREFERRED, nodemask, ...);
>>>
>>> Here, 'nodemask' is a bitmap of host NUMA nodes and corresponds
>>> to the .host-nodes attribute. Therefore, there can be multiple
>>> nodes specified. However, the documentation to MPOL_PREFERRED
>>> says:
>>>
>>>     MPOL_PREFERRED
>>>       This mode sets the preferred node for allocation. ...
>>>       If nodemask specifies more than one node ID, the first node
>>>       in the mask will be selected as the preferred node.
>>>
>>> Therefore, only the first node is honored and the rest is
>>> silently ignored. Well, with recent changes to the kernel and
>>> numactl we can do better.
>>>
>>> The Linux kernel added in v5.15 via commit cfcaa66f8032
>>> ("mm/hugetlb: add support for mempolicy MPOL_PREFERRED_MANY")
>>> support for MPOL_PREFERRED_MANY, which accepts multiple preferred
>>> NUMA nodes instead.
>>>
>>> Then, numa_has_preferred_many() API was introduced to numactl
>>> (v2.0.15~26) allowing applications to query kernel support.
>>>
>>> Wiring this all together, we can pass MPOL_PREFERRED_MANY to the
>>> mbind() call instead and stop ignoring multiple nodes, silently.
>>>
>>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>>> ---
>>
>> [...]
>>
>>> +#ifdef HAVE_NUMA_SET_PREFERRED_MANY

That should be HAVE_NUMA_HAS_PREFERRED_MANY, right?

-- 
Thanks,

David / dhildenb



  reply	other threads:[~2022-12-19  9:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15  9:55 [PATCH v2] hostmem: Honor multiple preferred nodes if possible Michal Privoznik
2022-12-16 13:41 ` David Hildenbrand
2022-12-16 13:47   ` Michal Prívozník
2022-12-19  9:55     ` David Hildenbrand [this message]
2022-12-19  9:57       ` Michal Prívozník
2022-12-19  9:58         ` David Hildenbrand
2022-12-19 11:10           ` Michal Prívozník
2022-12-19 15:23             ` 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=536107c6-b142-d5aa-0d94-4277a5c5af15@redhat.com \
    --to=david@redhat.com \
    --cc=berrange@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mprivozn@redhat.com \
    --cc=qemu-devel@nongnu.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 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.