lkml.org 
[lkml]   [2018]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCHv5 11/19] x86/mm: Implement vma_keyid()
    From
    Date
    > --- 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
    }

    \
     
     \ /
      Last update: 2018-07-19 01:41    [W:3.170 / U:0.148 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site