lkml.org 
[lkml]   [2018]   [Jul]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCHv5 11/19] x86/mm: Implement vma_keyid()
    On Wed, Jul 18, 2018 at 04:40:14PM -0700, Dave Hansen wrote:
    > > --- 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
    > }

    Okay. I'll do this. But it would be a macros. <asm/mktme.h> gets included
    very early. We cannot really use jump label code there directly.

    --
    Kirill A. Shutemov

    \
     
     \ /
      Last update: 2018-07-23 11:48    [W:3.120 / U:1.376 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site