linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Wanpeng Li <kernellwp@gmail.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	Ben Gardon <bgardon@google.com>,
	Shakeel Butt <shakeelb@google.com>
Subject: Re: [PATCH] KVM: arm: memcg awareness
Date: Wed, 17 Mar 2021 11:03:14 +0000	[thread overview]
Message-ID: <87h7lahwjx.wl-maz@kernel.org> (raw)
In-Reply-To: <21d1f531-fe95-224d-0dac-6917d473063d@redhat.com>

On Wed, 17 Mar 2021 10:55:00 +0000,
Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
> On 17/03/21 11:53, Marc Zyngier wrote:
> > On Wed, 17 Mar 2021 10:40:23 +0000,
> > Paolo Bonzini <pbonzini@redhat.com> wrote:
> >> 
> >> On 17/03/21 10:10, Marc Zyngier wrote:
> >>>> @@ -366,7 +366,7 @@ static int hyp_map_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep,
> >>>>    	if (WARN_ON(level == KVM_PGTABLE_MAX_LEVELS - 1))
> >>>>    		return -EINVAL;
> >>>>    -	childp = (kvm_pte_t *)get_zeroed_page(GFP_KERNEL);
> >>>> +	childp = (kvm_pte_t *)get_zeroed_page(GFP_KERNEL_ACCOUNT);
> >>> No, this is wrong.
> >>> 
> >>> You cannot account the hypervisor page tables to the guest because we
> >>> don't ever unmap them, and that we can't distinguish two data
> >>> structures from two different VMs occupying the same page.
> >> 
> >> If you never unmap them, there should at least be a shrinker to get
> >> rid of unused pages in the event of memory pressure.
> > 
> > We don't track where these pages are coming from or whether they can
> > safely be unmapped. Until we can track such ownership and deal with
> > page sharing, these mappings have to stay,
> > 
> > At most, this represent the amount of memory required to map the whole
> > of the linear mapping.
> 
> Ah, these are the EL2 pages, not the stage2 page tables, right?  If
> so, sorry for the noise.

Yes, EL2 page tables when running non-VHE. VHE doesn't have that
problem for obvious reasons. Stage-2 page tables can be completely
discarded at any point, and the MMU notifiers already deal with that.

	M.

-- 
Without deviation from the norm, progress is not possible.

      reply	other threads:[~2021-03-17 11:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17  5:46 [PATCH] KVM: arm: memcg awareness Wanpeng Li
2021-03-17  7:57 ` Michal Hocko
2021-03-17  8:04   ` Wanpeng Li
2021-03-17  8:04     ` Wanpeng Li
2021-03-17  9:44       ` Michal Hocko
2021-03-17  9:15     ` Marc Zyngier
2021-03-17  9:10 ` Marc Zyngier
2021-03-17 10:40   ` Paolo Bonzini
2021-03-17 10:53     ` Marc Zyngier
2021-03-17 10:55       ` Paolo Bonzini
2021-03-17 11:03         ` Marc Zyngier [this message]

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=87h7lahwjx.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=bgardon@google.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=shakeelb@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).