[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a204a032-5e2b-63f6-31d3-c17014f94c8b@intel.com>
Date: Wed, 18 Jul 2018 16:40:14 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>,
Tom Lendacky <thomas.lendacky@....com>
Cc: Kai Huang <kai.huang@...ux.intel.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCHv5 11/19] x86/mm: Implement vma_keyid()
> --- a/arch/x86/mm/mktme.c
> +++ b/arch/x86/mm/mktme.c
> @@ -1,3 +1,4 @@
> +#include <linux/mm.h>
> #include <asm/mktme.h>
>
> phys_addr_t mktme_keyid_mask;
> @@ -37,3 +38,14 @@ struct page_ext_operations page_mktme_ops = {
> .need = need_page_mktme,
> .init = init_page_mktme,
> };
> +
> +int vma_keyid(struct vm_area_struct *vma)
> +{
> + pgprotval_t prot;
> +
> + if (!mktme_enabled())
> + return 0;
> +
> + prot = pgprot_val(vma->vm_page_prot);
> + return (prot & mktme_keyid_mask) >> mktme_keyid_shift;
> +}
I'm a bit surprised this isn't inlined. Not that function calls are
expensive, but we *could* entirely avoid them using the normal pattern of:
// In the header:
static inline vma_keyid(...)
{
if (!mktme_enabled())
return 0;
return __vma_keyid(...); // <- the .c file version
}
Powered by blists - more mailing lists