From: "Huang, Kai" <kai.huang@intel.com>
To: Yongqiang Liu <liuyongqiang13@huawei.com>, <kvm@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <zhangxiaoxu5@huawei.com>,
<hpa@zytor.com>, <x86@kernel.org>, <dave.hansen@linux.intel.com>,
<bp@alien8.de>, <mingo@redhat.com>, <tglx@linutronix.de>,
<pbonzini@redhat.com>, <seanjc@google.com>
Subject: Re: [PATCH -next] KVM: SVM: Remove unnecessary GFP_KERNEL_ACCOUNT in svm_set_nested_state()
Date: Fri, 23 Aug 2024 12:03:28 +1200 [thread overview]
Message-ID: <b3c27ca7-a409-4df5-bb55-3c3314347d7d@intel.com> (raw)
In-Reply-To: <20240821112737.3649937-1-liuyongqiang13@huawei.com>
On 21/08/2024 11:27 pm, Yongqiang Liu wrote:
> The fixed size temporary variables vmcb_control_area and vmcb_save_area
> allocated in svm_set_nested_state() are released when the function exits.
> Meanwhile, svm_set_nested_state() also have vcpu mutex held to avoid
> massive concurrency allocation, so we don't need to set GFP_KERNEL_ACCOUNT.
Hi Sean/Paolo,
Seems more patches are popping up regarding to whether to use _ACCOUNT
for temporary memory allocation. Could we have a definitive guide on this?
As you know, one similar patch was merged and now is in upstream:
dd103407ca315 ("KVM: X86: Remove unnecessary GFP_KERNEL_ACCOUNT for
temporary variables")
Also see:
https://lore.kernel.org/kvm/20240715101224.90958-1-kai.huang@intel.com/T/
>
> Signed-off-by: Yongqiang Liu <liuyongqiang13@huawei.com>
> ---
> arch/x86/kvm/svm/nested.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
> index 6f704c1037e5..d5314cb7dff4 100644
> --- a/arch/x86/kvm/svm/nested.c
> +++ b/arch/x86/kvm/svm/nested.c
> @@ -1693,8 +1693,8 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,
> return -EINVAL;
>
> ret = -ENOMEM;
> - ctl = kzalloc(sizeof(*ctl), GFP_KERNEL_ACCOUNT);
> - save = kzalloc(sizeof(*save), GFP_KERNEL_ACCOUNT);
> + ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
> + save = kzalloc(sizeof(*save), GFP_KERNEL);
> if (!ctl || !save)
> goto out_free;
>
next prev parent reply other threads:[~2024-08-23 0:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 11:27 Yongqiang Liu
2024-08-23 0:03 ` Huang, Kai [this message]
2024-08-24 0:00 ` Sean Christopherson
2024-08-24 9:33 ` Huang, Kai
2024-08-23 23:47 ` Sean Christopherson
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=b3c27ca7-a409-4df5-bb55-3c3314347d7d@intel.com \
--to=kai.huang@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyongqiang13@huawei.com \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=zhangxiaoxu5@huawei.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
all inboxes | Powered by JetHome®