Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751795AbdFTGVR (ORCPT ); Tue, 20 Jun 2017 02:21:17 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38170 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751095AbdFTGVP (ORCPT ); Tue, 20 Jun 2017 02:21:15 -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 5/7] userfaultfd: shmem: wire up shmem_mfill_zeropage_pte Date: Tue, 20 Jun 2017 09:20:50 +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-0040-0000-0000-000003CE1B29 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17062006-0041-0000-0000-00002067B92C Message-Id: <1497939652-16528-6-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: 853 Lines: 29 For shmem VMAs we can use shmem_mfill_zeropage_pte for UFFDIO_ZEROPAGE Signed-off-by: Mike Rapoport --- mm/userfaultfd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index 48c015c..8119270 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -389,11 +389,13 @@ static __always_inline ssize_t mfill_atomic_pte(struct mm_struct *dst_mm, err = mfill_zeropage_pte(dst_mm, dst_pmd, dst_vma, dst_addr); } else { - err = -EINVAL; /* if zeropage is true return -EINVAL */ - if (likely(!zeropage)) + if (!zeropage) err = shmem_mcopy_atomic_pte(dst_mm, dst_pmd, dst_vma, dst_addr, src_addr, page); + else + err = shmem_mfill_zeropage_pte(dst_mm, dst_pmd, + dst_vma, dst_addr); } return err; -- 2.7.4