From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 282E7C433E0 for ; Tue, 23 Feb 2021 18:06:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A039064E24 for ; Tue, 23 Feb 2021 18:06:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A039064E24 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 376886B006E; Tue, 23 Feb 2021 13:06:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 324D76B0070; Tue, 23 Feb 2021 13:06:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 23AF46B0071; Tue, 23 Feb 2021 13:06:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 0C9946B006E for ; Tue, 23 Feb 2021 13:06:38 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C9309180AD83E for ; Tue, 23 Feb 2021 18:06:37 +0000 (UTC) X-FDA: 77850312834.12.7FEFA6E Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) by imf27.hostedemail.com (Postfix) with ESMTP id 1BAE1801A830 for ; Tue, 23 Feb 2021 18:06:22 +0000 (UTC) Received: by mail-io1-f48.google.com with SMTP id f6so18088567iop.11 for ; Tue, 23 Feb 2021 10:06:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vTI/ZdZz+qz8Dx2SLW9Ocz24gRVgR01CbdQNKNmll5k=; b=kJv3Zxq0E0xdXJMdBV0Qymaxo3EKmXLhrzNKEoR1lEq6FQ2L+KIToHQV71nOETjiu4 jSIDazyhhQfKFV3Siq4AGLLgHpeAJgvfeNFFwl6ZBV/NypjnFAv26PscPklbQKZkbhIg KDaQvT5mNTADuS2BE5Z/VFllYEjnbu736vlWbV0xSE74lwfdo2P+3SMSBuWCzk2d90X5 HmYlmKJd0nucCD/9eyNVU9egBEf6Y/sqkUNBf1FGWNLYulQ3vHiy1IEDz5FiGqsOc2JY bnw/q/JSbt8u8APa8ShoLnkzb05+xx30eFz/W7GHM/NuZn1EL1MmXYGVk82D0N3MXgUO D+zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vTI/ZdZz+qz8Dx2SLW9Ocz24gRVgR01CbdQNKNmll5k=; b=ngn2oPHLUAqypOlTkz5WluxJRQYGYMIm7/aRjQH7sbFU5PNfWHjfdR4NDHbOGxBUoY fBW/I8IFXU8rLI5F+6sHaKZcv941mm4DAE7ABhwl7cq1Ef7eBbSD04ExcsIN7q2Stk8D B/BcsrUvVw1JAG0e8phAPLfAUMLUMaKIX6tXxdAUz77xrQcRUYGAJjbSnubd3Bigf/4Z /a8atROZhIqBzKuqvRX1Klg5ykOpPIYh1PANzjvsAYoojg0V/etasnIm3m+YS910jOYT /DCnJ60rhG1E+zt3C49vw8K+JmZZOHFZiNe45POHnYfdMC2tOc4EaxwkwedzzukVEHse Q7WQ== X-Gm-Message-State: AOAM532RHs051nJ2odnfD5j9l0ZOyNOhmyVX6oEor+5vx28kBpZfd4CZ cbm8H+DApQVYLI5GujMq9ChfsZc9FEk694bPHXV+bg== X-Google-Smtp-Source: ABdhPJzpHY27RWxiyNrVgREJDawnkqSWtUel0EdDg7HXH+35aHSwQVloU4RBy57ghfHc1GSt5G6KzF/z83VRwCEKrxE= X-Received: by 2002:a6b:c84a:: with SMTP id y71mr20733760iof.86.1614103587647; Tue, 23 Feb 2021 10:06:27 -0800 (PST) MIME-Version: 1.0 References: <20210219004824.2899045-1-axelrasmussen@google.com> <20210219004824.2899045-5-axelrasmussen@google.com> <20210223153840.GB154711@xz-x1> In-Reply-To: <20210223153840.GB154711@xz-x1> From: Axel Rasmussen Date: Tue, 23 Feb 2021 10:05:49 -0800 Message-ID: Subject: Re: [PATCH v7 4/6] userfaultfd: add UFFDIO_CONTINUE ioctl To: Peter Xu Cc: Alexander Viro , Alexey Dobriyan , Andrea Arcangeli , Andrew Morton , Anshuman Khandual , Catalin Marinas , Chinwen Chang , Huang Ying , Ingo Molnar , Jann Horn , Jerome Glisse , Lokesh Gidra , "Matthew Wilcox (Oracle)" , Michael Ellerman , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Michel Lespinasse , Mike Kravetz , Mike Rapoport , Nicholas Piggin , Shaohua Li , Shawn Anastasio , Steven Rostedt , Steven Price , Vlastimil Babka , LKML , linux-fsdevel@vger.kernel.org, Linux MM , Adam Ruprecht , Cannon Matthews , "Dr . David Alan Gilbert" , David Rientjes , Mina Almasry , Oliver Upton Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 1BAE1801A830 X-Stat-Signature: cpw3kooct96cf8ycyox5mi87piiq8wt7 Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf27; identity=mailfrom; envelope-from=""; helo=mail-io1-f48.google.com; client-ip=209.85.166.48 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614103582-152637 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Feb 23, 2021 at 7:38 AM Peter Xu wrote: > > On Thu, Feb 18, 2021 at 04:48:22PM -0800, Axel Rasmussen wrote: > > @@ -4645,8 +4646,18 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, > > spinlock_t *ptl; > > int ret; > > struct page *page; > > + int writable; > > > > - if (!*pagep) { > > + mapping = dst_vma->vm_file->f_mapping; > > + idx = vma_hugecache_offset(h, dst_vma, dst_addr); > > + > > + if (is_continue) { > > + ret = -EFAULT; > > + page = find_lock_page(mapping, idx); > > + *pagep = NULL; > > Why set *pagep to NULL? Shouldn't it be NULL always?.. If that's the case, > maybe WARN_ON_ONCE(*pagep) suite more. Right, the caller should be passing in NULL in the MCOPY_ATOMIC_CONTINUE case. Looking more closely at the caller (__mcopy_atomic_hugetlb), it already has a BUG_ON(page), so at best this assignment is redundant, and at worst it might actually cover up a real bug (say the caller mistakenly *did* pass in some page, we'd set it to NULL and the BUG_ON wouldn't trigger). So, I'll just remove this - I don't think an additional WARN_ON_ONCE is needed given the existing BUG_ON. > > Otherwise the patch looks good to me. Shall I add a R-B? :) Thanks for taking the time to review Peter! > > Thanks, > > -- > Peter Xu >