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=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 E6CFDC433E0 for ; Tue, 23 Feb 2021 18:29:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7A58E64E57 for ; Tue, 23 Feb 2021 18:29:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A58E64E57 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F211D6B0005; Tue, 23 Feb 2021 13:29:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EAB446B0006; Tue, 23 Feb 2021 13:29:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4BEF6B006E; Tue, 23 Feb 2021 13:29:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0006.hostedemail.com [216.40.44.6]) by kanga.kvack.org (Postfix) with ESMTP id BA09B6B0005 for ; Tue, 23 Feb 2021 13:29:22 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 78962181AEF39 for ; Tue, 23 Feb 2021 18:29:22 +0000 (UTC) X-FDA: 77850370164.17.AE41AA3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 83E23200039A for ; Tue, 23 Feb 2021 18:29:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614104942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=o+lMNmwE9sWeaJZim5ktBynQMO9mBkWFkIPu3ZX6sdY=; b=GxTI5FNILOwQGgO1im5rT80uUghcNdet7H1yRoj0nI2rCJwZ+w2uw0uWQu1NGk5QVYskYi zs1+9flIieVgh9vgXQn2c7RyuLG4H1JfIHW+5doLTxgagC/HAXpgIJbZLKGjZ0WzG1p+Uv hgcabndRFG/vLrIYVLnuRzunbw8csz4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614104952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=o+lMNmwE9sWeaJZim5ktBynQMO9mBkWFkIPu3ZX6sdY=; b=VQNxEFbCVtRyhiA4F+cw9QiWo44OWZ8YglAuxTaZLVwnjXfEWgYw8dOZ4+oIBooWK4cTfZ Ol2bxMYD8gHRfVZ6CBP1Y+NbKgiuByPmxhGq8Thz3H63KLrJFS9sY70BHUPPkBcDRBa7p8 GtLNEz69gNdNZO8Waw2GXl9kXvufwGE= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-435-DOu1CnR6NO-P6oj8Xq2CYg-1; Tue, 23 Feb 2021 13:29:00 -0500 X-MC-Unique: DOu1CnR6NO-P6oj8Xq2CYg-1 Received: by mail-qk1-f199.google.com with SMTP id u14so12372058qke.14 for ; Tue, 23 Feb 2021 10:29:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=o+lMNmwE9sWeaJZim5ktBynQMO9mBkWFkIPu3ZX6sdY=; b=afSBmRmSK7F/riDml7wYngBSZ3tg9rUIS0Xhf1cIXpQdxYzE5eaqd6beDQ38zoMYG3 yu7Lj3Cuh2qMI+46CfgdRs1OjOXPrtK0fPancgT+WrGi/TxKMN/gwFdohKo4dUBVCaMh f4V6l6RXxhqThIm13KLKUnL6vQAGvPfXda7iB4uEXy3fDTuc8DR7v9hDladv5P3bFmkJ c2zAuOhVfAr7P8hJxxYOzeVwor2JAIb0ybXS5Hlq+tiEldFk1A2vSDxOaWy7TRIriUgZ ftwfF1y23o/depcKr0s8l+7GQKl4z/rREaHWXsx/rSwA6PecwwnSmC1Y0wVzKzpLugko +uig== X-Gm-Message-State: AOAM532ZrYTzl7C6KhjTp2qffwFPMejKkX2445/UNaevLacicEsGpe+9 RLVXJqarGw1+maTUzgqK8WS6dVfTtbscLkXBLqGaVFFYtaQ+wAaXpkWPFkucGCjHs6l1AVQKhe2 Xwv6WbZxCqVU= X-Received: by 2002:a05:620a:21c2:: with SMTP id h2mr27925119qka.494.1614104940024; Tue, 23 Feb 2021 10:29:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/BshTm6p2mAAGoJn9l2lOs8hsKvkpGfB8X8pMIvq7Eii7zi5lDF8avtFrEUscK2NizzpzIA== X-Received: by 2002:a05:620a:21c2:: with SMTP id h2mr27925073qka.494.1614104939764; Tue, 23 Feb 2021 10:28:59 -0800 (PST) Received: from xz-x1 (bras-vprn-toroon474qw-lp130-25-174-95-95-253.dsl.bell.ca. [174.95.95.253]) by smtp.gmail.com with ESMTPSA id d5sm9388455qtd.67.2021.02.23.10.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Feb 2021 10:28:58 -0800 (PST) Date: Tue, 23 Feb 2021 13:28:56 -0500 From: Peter Xu To: Axel Rasmussen 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 , Michal =?utf-8?Q?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 Subject: Re: [PATCH v7 4/6] userfaultfd: add UFFDIO_CONTINUE ioctl Message-ID: <20210223182856.GA176114@xz-x1> References: <20210219004824.2899045-1-axelrasmussen@google.com> <20210219004824.2899045-5-axelrasmussen@google.com> <20210223153840.GB154711@xz-x1> MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Stat-Signature: aiipya8dhipuwkoe9uyptpfj9uxpk8pj X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 83E23200039A Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf28; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614104953-496419 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 10:05:49AM -0800, Axel Rasmussen wrote: > 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. It's still okay to have the WARN_ON_ONCE; it gives a direct hint that *pagep should never be set for uffdio_continue. No strong opinion. > > > > > Otherwise the patch looks good to me. > > Shall I add a R-B? :) Yes, as long as "*pagep = NULL" dropped, please feel free to. :) Thanks, -- Peter Xu