Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751990AbdFTGVY (ORCPT ); Tue, 20 Jun 2017 02:21:24 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:53999 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751813AbdFTGVV (ORCPT ); Tue, 20 Jun 2017 02:21:21 -0400 From: Mike Rapoport To: Andrew Morton Cc: Andrea Arcangeli , Hugh Dickins , "Kirill A. Shutemov" , Hillf Danton , Pavel Emelyanov , linux mm , lkml , Mike Rapoport Subject: [PATCH 6/7] userfaultfd: report UFFDIO_ZEROPAGE as available for shmem VMAs Date: Tue, 20 Jun 2017 09:20:51 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497939652-16528-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1497939652-16528-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17062006-0020-0000-0000-0000038C1968 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17062006-0021-0000-0000-0000420C9F18 Message-Id: <1497939652-16528-7-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-20_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706200115 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1708 Lines: 52 Now when shmem VMAs can be filled with zero page via userfaultfd we can report that UFFDIO_ZEROPAGE is available for those VMAs Signed-off-by: Mike Rapoport --- fs/userfaultfd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index f7555fc..57794c2 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -1183,7 +1183,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx, struct uffdio_register __user *user_uffdio_register; unsigned long vm_flags, new_flags; bool found; - bool non_anon_pages; + bool basic_ioctls; unsigned long start, end, vma_end; user_uffdio_register = (struct uffdio_register __user *) arg; @@ -1249,7 +1249,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx, * Search for not compatible vmas. */ found = false; - non_anon_pages = false; + basic_ioctls = false; for (cur = vma; cur && cur->vm_start < end; cur = cur->vm_next) { cond_resched(); @@ -1288,8 +1288,8 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx, /* * Note vmas containing huge pages */ - if (is_vm_hugetlb_page(cur) || vma_is_shmem(cur)) - non_anon_pages = true; + if (is_vm_hugetlb_page(cur)) + basic_ioctls = true; found = true; } @@ -1360,7 +1360,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx, * userland which ioctls methods are guaranteed to * succeed on this range. */ - if (put_user(non_anon_pages ? UFFD_API_RANGE_IOCTLS_BASIC : + if (put_user(basic_ioctls ? UFFD_API_RANGE_IOCTLS_BASIC : UFFD_API_RANGE_IOCTLS, &user_uffdio_register->ioctls)) ret = -EFAULT; -- 2.7.4