linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vipin Sharma <vipinsh@google.com>
To: David Matlack <dmatlack@google.com>
Cc: bgardon@google.com, seanjc@google.com, pbonzini@redhat.com,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Patch v2 2/2] KVM: x86/mmu: Allocate page table pages on NUMA node of underlying pages
Date: Fri, 9 Dec 2022 10:51:00 -0800	[thread overview]
Message-ID: <CAHVum0czjbxwme3x4o2y437gFoLx_1q5hZMvKSrwTggFtYDZeg@mail.gmail.com> (raw)
In-Reply-To: <Y5KBDXzPFw3PaSVD@google.com>

On Thu, Dec 8, 2022 at 4:28 PM David Matlack <dmatlack@google.com> wrote:
>
> On Thu, Dec 01, 2022 at 11:57:18AM -0800, Vipin Sharma wrote:
> > Page table pages of a VM are currently allocated based on the current
> > task's NUMA node or its mempolicy. This can cause suboptimal remote
> > accesses by the vCPU if it is accessing physical pages local to its NUMA
> > node but the page table pages mapping those physcal pages were created
> > by some other vCPU which was on different NUMA node or had different
> > policy.
> >
> > Allocate page table pages on the same NUMA node where underlying
> > physical page exists. Page table at level 5, 4, and 3 might not end up
> > on the same NUMA node as they can span multiple NUMA nodes.
> >
> > Signed-off-by: Vipin Sharma <vipinsh@google.com>
> > ---
> ...
> > @@ -6284,13 +6326,16 @@ static int shadow_mmu_try_split_huge_page(struct kvm *kvm,
> >       gfn = kvm_mmu_page_get_gfn(huge_sp, spte_index(huge_sptep));
> >       level = huge_sp->role.level;
> >       spte = *huge_sptep;
> > +     nid = kvm_pfn_to_refcounted_page_nid(spte_to_pfn(spte));
> > +     if (nid == NUMA_NO_NODE)
> > +             nid = numa_mem_id();
>
> What do you think about renaming kvm_pfn_to_refcounted_page_nid() to
> kvm_pfn_to_page_table_nid() and having it return numa_mem_id() instead
> of NUMA_NO_NODE (with a comment)? I think that will clean up this patch
> quite a bit by getting rid of all the NUMA_NO_NODE checks.

Yeah, this will clean up this patch. I will make this change in the
next version.

  reply	other threads:[~2022-12-09 18:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 19:57 [Patch v2 0/2] NUMA aware page table allocation Vipin Sharma
2022-12-01 19:57 ` [Patch v2 1/2] KVM: x86/mmu: Allocate page table pages on TDP splits during dirty log enable on the underlying page's numa node Vipin Sharma
2022-12-05 18:24   ` Ben Gardon
2022-12-05 18:47     ` Sean Christopherson
2022-12-05 18:51       ` Ben Gardon
2022-12-05 21:07         ` Sean Christopherson
2022-12-08 22:44           ` Vipin Sharma
2022-12-01 19:57 ` [Patch v2 2/2] KVM: x86/mmu: Allocate page table pages on NUMA node of underlying pages Vipin Sharma
2022-12-05 18:17   ` Ben Gardon
2022-12-05 23:40     ` Vipin Sharma
2022-12-06 18:17       ` Ben Gardon
     [not found]         ` <CAHVum0f_6UQvcqWAJxDJyL_LN-6ryAXNuh9xY6nFtLxCOMtoXA@mail.gmail.com>
     [not found]           ` <CANgfPd-XkHPZyFsPe75WbUrufLpKtdr1Neri1JrrApQrjRLRJw@mail.gmail.com>
     [not found]             ` <CAHVum0dkKSY9e90xgfBVBHUqntwJOmONK+TYBXFEwg6acvUrAw@mail.gmail.com>
2022-12-07 19:05               ` Vipin Sharma
2022-12-09  0:06                 ` David Matlack
2022-12-09 18:47                   ` Vipin Sharma
2022-12-09  0:27   ` David Matlack
2022-12-09 18:51     ` Vipin Sharma [this message]
2022-12-09  0:21 ` [Patch v2 0/2] NUMA aware page table allocation David Matlack

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=CAHVum0czjbxwme3x4o2y437gFoLx_1q5hZMvKSrwTggFtYDZeg@mail.gmail.com \
    --to=vipinsh@google.com \
    --cc=bgardon@google.com \
    --cc=dmatlack@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    /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).