From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE925C433E0 for ; Wed, 17 Mar 2021 10:55:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B01964F64 for ; Wed, 17 Mar 2021 10:55:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230526AbhCQKzP (ORCPT ); Wed, 17 Mar 2021 06:55:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:53196 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230080AbhCQKzF (ORCPT ); Wed, 17 Mar 2021 06:55:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615978504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I0iQk6VEOom/eWob3kLIdsJKi0P3emqz/ktzR7mzDu0=; b=QNsShnfiYMwyrVWapsPlbmR/XZPodsmkHHV0oI4bu2iFAvjniTjhv7D06KcGrn3SJWgtll B7+d92aDuyJpV3UzIIh8u2uGhq81QEe9bbcnDPKLBHpjTAgYRQh6pKEitjFAHch1gqd9st HAoWnLn3zdKaEK1MPON+DtD5Xpve2ng= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-a0IkQlxzMJCuPfms5gV5Ww-1; Wed, 17 Mar 2021 06:55:03 -0400 X-MC-Unique: a0IkQlxzMJCuPfms5gV5Ww-1 Received: by mail-ed1-f71.google.com with SMTP id h5so19175047edf.17 for ; Wed, 17 Mar 2021 03:55:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=I0iQk6VEOom/eWob3kLIdsJKi0P3emqz/ktzR7mzDu0=; b=g3XX8fEgt7OjtBijDi2q9giDytpMisabXuDU8P0s76nRklfxH+Mhh2v9UWChtj8XES ZgRA/OACnAPMTlyvcoNEolIrzdzQjBkHTXADvs5wkg1szyZd3kREgueGUn8789kACXZ/ 7YEhEdnbSKjvzFtn5tsecLE6OeeZl4ARTI6AbrQ2JWbHznJeV2t36XVSRDfwEgTQgGgn txl8bAdJL2l+8wlhiUmR1ZteVmJQWM0M1rYq5wQrarT3hmALzLK0UvO3rx4BjQSo9UAt OJpbOe1OFtAdyBRmR552mvuBbzEHzpb+ypRSL4885JKgecl8CfkV/CLnYSm2UcSyUjvn LDyQ== X-Gm-Message-State: AOAM533Qle6uSPA2ay4LIfjcjwlK6aUvih6+vChNaal/Swo6K/1e/Zjk IrdUr/qXN96rgMj6nA+flrQ6JQ6zkPI5FHOC1JWs3hTMxGAC0NugmrvhnzDake1PejZt5YGlpUX 1Xl4fyjb2Rq03iqFgVYz0n9KG X-Received: by 2002:a17:906:a0d4:: with SMTP id bh20mr2929707ejb.348.1615978502069; Wed, 17 Mar 2021 03:55:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+kyFZnmJb0l4PG4SXpwlc3jFPbkz+a4nfWrVz111dda3+5+tVo3sQJRINh98la4e0BrJK0Q== X-Received: by 2002:a17:906:a0d4:: with SMTP id bh20mr2929698ejb.348.1615978501946; Wed, 17 Mar 2021 03:55:01 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id ho11sm10682614ejc.112.2021.03.17.03.55.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Mar 2021 03:55:01 -0700 (PDT) Subject: Re: [PATCH] KVM: arm: memcg awareness To: Marc Zyngier Cc: Wanpeng Li , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Ben Gardon , Shakeel Butt References: <1615959984-7122-1-git-send-email-wanpengli@tencent.com> <87mtv2i1s3.wl-maz@kernel.org> <87im5qhwzx.wl-maz@kernel.org> From: Paolo Bonzini Message-ID: <21d1f531-fe95-224d-0dac-6917d473063d@redhat.com> Date: Wed, 17 Mar 2021 11:55:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <87im5qhwzx.wl-maz@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/03/21 11:53, Marc Zyngier wrote: > On Wed, 17 Mar 2021 10:40:23 +0000, > Paolo Bonzini 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. Paolo