From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759272AbcLPSgn (ORCPT ); Fri, 16 Dec 2016 13:36:43 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:39039 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758496AbcLPSgM (ORCPT ); Fri, 16 Dec 2016 13:36:12 -0500 From: Mike Kravetz To: sparclinux@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "David S . Miller" , Bob Picco , Nitin Gupta , Vijay Kumar , Julian Calaby , Adam Buchbinder , "Kirill A . Shutemov" , Michal Hocko , Andrew Morton , Mike Kravetz Subject: [RFC PATCH 10/14] mm: add shared context to vm_area_struct Date: Fri, 16 Dec 2016 10:35:33 -0800 Message-Id: <1481913337-9331-11-git-send-email-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481913337-9331-1-git-send-email-mike.kravetz@oracle.com> References: <1481913337-9331-1-git-send-email-mike.kravetz@oracle.com> X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Shared context usage is reflected in a vm area (vma). To handle this, a new flag (VM_SHARED_CTX) is added anlng with a pointer to a shared context structure (vm_shared_mmu_ctx). This commit does not contain the method by which a vma is marked for shared context. Signed-off-by: Mike Kravetz --- include/linux/mm.h | 1 + include/linux/mm_types.h | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index a92c8d7..9d82028 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -182,6 +182,7 @@ extern unsigned int kobjsize(const void *objp); #define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */ #define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */ #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ +#define VM_SHARED_CTX 0x00800000 /* Shared TLB context */ #define VM_ARCH_1 0x01000000 /* Architecture-specific flag */ #define VM_ARCH_2 0x02000000 #define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */ diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 4a8aced..0c30d43 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -291,6 +291,18 @@ struct vm_userfaultfd_ctx { struct vm_userfaultfd_ctx {}; #endif /* CONFIG_USERFAULTFD */ +#ifdef CONFIG_SHARED_MMU_CTX +#define NULL_VM_SHARED_MMU_CTX ((struct vm_shared_mmu_ctx) { NULL, }) +struct vm_shared_mmu_ctx { + struct shared_mmu_ctx *ctx; +}; +#define vma_shared_ctx_val(vma) \ + ((vma)->vm_shared_mmu_ctx.ctx ? \ + (vma)->vm_shared_mmu_ctx.ctx->shared_ctx_val : 0UL) +#else /* CONFIG_SHARED__MMU_CTX */ +struct vm_shared_mmu_ctx {}; +#endif /* CONFIG_SHARED_MMU_CTX */ + /* * This struct defines a memory VMM memory area. There is one of these * per VM-area/task. A VM area is any part of the process virtual memory @@ -358,6 +370,7 @@ struct vm_area_struct { struct mempolicy *vm_policy; /* NUMA policy for the VMA */ #endif struct vm_userfaultfd_ctx vm_userfaultfd_ctx; + struct vm_shared_mmu_ctx vm_shared_mmu_ctx; }; struct core_thread { -- 2.7.4