Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1456368
| Path | csiph.com!news.freedyn.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Mike Rapoport <rppt@linux.vnet.ibm.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/7] userfaultfd: shmem: introduce vma_is_shmem |
| Date | Thu, 04 Aug 2016 14:30:01 +0200 |
| Message-ID | <s2pWF-yi-5@gated-at.bofh.it> (permalink) |
| References | <s2mYO-6W6-37@gated-at.bofh.it> |
| X-Ibm-Helo | d06dlp03.portsmouth.uk.ibm.com |
| X-Ibm-Mailfrom | rppt@linux.vnet.ibm.com |
| X-Ibm-Rcptto | linux-kernel@vger.kernel.org |
| X-Mailer | git-send-email 1.9.1 |
| X-Tm-As-Mml | disable |
| X-Content-Scanned | Fidelis XPS MAILER |
| X-Cbid | 16080408-0032-0000-0000-000001F5E746 |
| X-Ibm-Av-Detection | SAVI=unused REMOTE=unused XFE=unused |
| X-Cbparentid | 16080408-0033-0000-0000-00001C42E23A |
| X-Proofpoint-Virus-Version | vendor=fsecure engine=2.50.10432:,, definitions=2016-08-04_06:,, signatures=0 |
| X-Proofpoint-Spam-Details | rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608040093 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 52 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Hugh Dickins <hughd@google.com>, Pavel Emelyanov <xemul@virtuozzo.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport <rppt@linux.vnet.ibm.com> |
| X-Original-Date | Thu, 4 Aug 2016 11:14:14 +0300 |
| X-Original-Message-ID | <1470298458-9925-4-git-send-email-rppt@linux.vnet.ibm.com> |
| X-Original-References | <1470298458-9925-1-git-send-email-rppt@linux.vnet.ibm.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1456368 |
Show key headers only | View raw
Currently userfault relies on vma_is_anonymous and vma_is_hugetlb to ensure
compatibility of a VMA with userfault. Introduction of vma_is_shmem allows
detection if tmpfs backed VMAs, so that they may be used with userfaultfd.
Current implementation presumes usage of vma_is_shmem only by slow path
routines in userfaultfd, therefore the vma_is_shmem is not made inline to
leave the few remaining free bits in vm_flags.
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
---
include/linux/mm.h | 10 ++++++++++
mm/shmem.c | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 1dedeb8..7a20398 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1343,6 +1343,16 @@ static inline bool vma_is_anonymous(struct vm_area_struct *vma)
return !vma->vm_ops;
}
+#ifdef CONFIG_SHMEM
+/*
+ * The vma_is_shmem is not inline because it is used only by slow
+ * paths in userfault.
+ */
+bool vma_is_shmem(struct vm_area_struct *vma);
+#else
+static inline bool vma_is_shmem(struct vm_area_struct *vma) { return false; }
+#endif
+
static inline int stack_guard_page_start(struct vm_area_struct *vma,
unsigned long addr)
{
diff --git a/mm/shmem.c b/mm/shmem.c
index fcf560c..881b7a0 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -194,6 +194,11 @@ static const struct inode_operations shmem_dir_inode_operations;
static const struct inode_operations shmem_special_inode_operations;
static const struct vm_operations_struct shmem_vm_ops;
+bool vma_is_shmem(struct vm_area_struct *vma)
+{
+ return vma->vm_ops == &shmem_vm_ops;
+}
+
static LIST_HEAD(shmem_swaplist);
static DEFINE_MUTEX(shmem_swaplist_mutex);
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/7] userfaultfd: add support for shared memory Mike Rapoport <rppt@linux.vnet.ibm.com> - 2016-08-04 13:50 +0200 [PATCH 3/7] userfaultfd: shmem: introduce vma_is_shmem Mike Rapoport <rppt@linux.vnet.ibm.com> - 2016-08-04 14:30 +0200 [PATCH 4/7] userfaultfd: shmem: use shmem_mcopy_atomic_pte for shared memory Mike Rapoport <rppt@linux.vnet.ibm.com> - 2016-08-04 15:30 +0200 [PATCH 7/7] userfaultfd: shmem: add userfaultfd_shmem test Mike Rapoport <rppt@linux.vnet.ibm.com> - 2016-08-04 16:00 +0200 Re: [PATCH 0/7] userfaultfd: add support for shared memory Andrea Arcangeli <aarcange@redhat.com> - 2016-08-04 21:00 +0200
csiph-web