[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <9dc1848f0fcbe3abe3d22584e339f2dfee60cb32.1656531090.git.khalid.aziz@oracle.com>
Date: Wed, 29 Jun 2022 16:54:00 -0600
From: Khalid Aziz <khalid.aziz@...cle.com>
To: akpm@...ux-foundation.org, willy@...radead.org
Cc: Khalid Aziz <khalid.aziz@...cle.com>, aneesh.kumar@...ux.ibm.com,
arnd@...db.de, 21cnbao@...il.com, corbet@....net,
dave.hansen@...ux.intel.com, david@...hat.com,
ebiederm@...ssion.com, hagen@...u.net, jack@...e.cz,
keescook@...omium.org, kirill@...temov.name, kucharsk@...il.com,
linkinjeon@...nel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
longpeng2@...wei.com, luto@...nel.org, markhemm@...glemail.com,
pcc@...gle.com, rppt@...nel.org, sieberf@...zon.com,
sjpark@...zon.de, surenb@...gle.com, tst@...oebel-theuer.de,
yzaikin@...gle.com
Subject: [PATCH v2 9/9] mm/mshare: Enable mshare region mapping across processes
This patch enables propcesses that did not create the mshare region
to map the region using mmap().
Signed-off-by: Khalid Aziz <khalid.aziz@...cle.com>
---
mm/mshare.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/mm/mshare.c b/mm/mshare.c
index 2ec0e56ffd69..455b10ca0cdf 100644
--- a/mm/mshare.c
+++ b/mm/mshare.c
@@ -144,7 +144,21 @@ msharefs_mmap(struct file *file, struct vm_area_struct *vma)
* page table sharing
*/
if (new_mm->mmap_base != 0) {
- return -EINVAL;
+ /*
+ * Any mappings of mshare region must use exact same
+ * virtual addresses
+ */
+ if ((vma->vm_start != new_mm->mmap_base) ||
+ (new_mm->task_size != (vma->vm_end - vma->vm_start)))
+ return -EINVAL;
+
+ vma->vm_private_data = info;
+ /*
+ * mshare pages are shared pages that also share page table
+ */
+ vma->vm_flags |= (VM_SHARED_PT|VM_SHARED);
+ vma->vm_ops = &msharefs_vm_ops;
+ refcount_inc(&info->refcnt);
} else {
struct mm_struct *old_mm;
struct vm_area_struct *new_vma;
--
2.32.0
Powered by blists - more mailing lists