Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp824841rwe; Wed, 31 Aug 2022 11:40:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR4UfsHh6sgpcwVSd8t860J9pJxNXIqulqJLS4F/lZPakV5JL3HFobmRJPM3lpcdaTyJB/FL X-Received: by 2002:a17:907:16a0:b0:741:833b:c4c9 with SMTP id hc32-20020a17090716a000b00741833bc4c9mr11749155ejc.524.1661971223227; Wed, 31 Aug 2022 11:40:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661971223; cv=none; d=google.com; s=arc-20160816; b=J6pHVMVj28QoRlAtNqGMKOlRD/r/eiLnr65pOi1jKCclfGI/hAKfpEvGuPaGVAz+zl fs1fSsm2X4/6da34moqClddAbQImywPt7XlozTgkSUKdLHq+YHdlBO2FCu1ZbvwNgTs2 Mw5quN7Bd70wsBQpCtJe/vO1rvUV5tehPYH+S2T1lYHxB2ja97jo1ybgks+sPw2erWbU y7+bgcDpNe1VcWt0RQPt5ASkPZG0cqsH0XDsJDtlMJAs4GBo4IlEqjzihXTo3E2LgVgB pXjxgF3MKmRGTHceUtlALcBrM+c/MiO4aw9FCZmyNbV94WnDcn/pyk06o8q45qHeaZrR urAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2pJGHwIH41qnK/ZRflZS9Bo8zc0dE9GkgGdGB0wqaq8=; b=UFybELWg5Tre8QUH6R5cq944IeirhJzH6KAlsNgf+diFAWVL91GdFydI+FsxFcfiNC 79b/ZxagZBjuUpW0MxXqAXXsfC2HyzFm2FOSot0dzDJFlLw9e1JplAHFOp5B2yYo4Wsc 73aKKZkxcUsHrNpHYypcUWSufD9piGe8+3wy7s7tbxmSJh3Axgnyee0sPBAlxxRqoXBi iYtY+ztSkvY9ZmH7BogvGPIx95MClUckivu1WQ13zO6BINePft3DV6fG+a+X2NnlIvWi KtdSM8dqOqfraDQuorZm7ier7dgDGYhAO1Qr6s8GPISIbvKCORfJNe652kWa7g3LWsRN f5tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hqj8Wd+U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf31-20020a1709077f1f00b0070795e99fe3si5066266ejc.984.2022.08.31.11.39.53; Wed, 31 Aug 2022 11:40:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hqj8Wd+U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232486AbiHaS1y (ORCPT + 99 others); Wed, 31 Aug 2022 14:27:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232818AbiHaS12 (ORCPT ); Wed, 31 Aug 2022 14:27:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BEDEF4906 for ; Wed, 31 Aug 2022 11:23:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661970200; 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=2pJGHwIH41qnK/ZRflZS9Bo8zc0dE9GkgGdGB0wqaq8=; b=hqj8Wd+UeoyyYPvl5KUEgrvAdI5WgJHUq9uj+D5JkjJUktcudkd5TM9gRp1XhyMSF2pUeN BgKaGF3ULjm6pS0Tr1JIyHaavP9dnrZGiLG+N3ayXp2AXUUDvGP8UCVNbxz6asY0xUTDmd tO+39MXqmEhHXrUAzUs6/tQX1s+2itA= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-327-gFZF4xrHNoSv5gYcS4l48w-1; Wed, 31 Aug 2022 14:23:19 -0400 X-MC-Unique: gFZF4xrHNoSv5gYcS4l48w-1 Received: by mail-qv1-f72.google.com with SMTP id e17-20020ad44431000000b00498f6fa689eso7557236qvt.9 for ; Wed, 31 Aug 2022 11:23:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=2pJGHwIH41qnK/ZRflZS9Bo8zc0dE9GkgGdGB0wqaq8=; b=ggTCIE13PwXBEnQzumOOKmucmCahNWeyQ639X9JlsvmhC+sMuobUFhRZp1mszhZLa0 nIv878IgpbdJUyLnVPjAuuNcxHvyuWiuBxhxu/vHqqrKeWNKmxnvWqxupUgctSgfdbNG J32Q38YWJmh7/X8fuSQ9a2eExo6jxTi5/gwPb6xLD85oTyTtoZujVon8O6ttBrKhGlhe UXic9/Yf58TlF3Gi84l4gExBd4mam7tw2xgzHnMDwnRFd72x3uo3Vj10U/hqVkV0/w8e i2oAx/Fpuxj+JxFLErvhbDPyAik1ZenAS3C25KNeZKbDoWakDYU/8UK+Nbzzqa8V8ZXr nrcg== X-Gm-Message-State: ACgBeo1DtWY1yjzauMfKJ8fDOlQLuzbNhhEF7Qo51WHERq65p9tUigZq aSvvk9g/HZ2SBLURtTcc9JanLmvazHAnbx473XM4uTZOcVgVaWVFcxs2lVPQIwcXEMs9t/aDTcG nuTpm0PgHFrT+nYqzMdtltZEr X-Received: by 2002:a05:622a:1196:b0:342:f7a9:a138 with SMTP id m22-20020a05622a119600b00342f7a9a138mr20722285qtk.344.1661970198934; Wed, 31 Aug 2022 11:23:18 -0700 (PDT) X-Received: by 2002:a05:622a:1196:b0:342:f7a9:a138 with SMTP id m22-20020a05622a119600b00342f7a9a138mr20722276qtk.344.1661970198740; Wed, 31 Aug 2022 11:23:18 -0700 (PDT) Received: from xz-m1.local (bras-base-aurron9127w-grc-35-70-27-3-10.dsl.bell.ca. [70.27.3.10]) by smtp.gmail.com with ESMTPSA id o15-20020a05620a2a0f00b006bb49cfe147sm11163767qkp.84.2022.08.31.11.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 11:23:18 -0700 (PDT) Date: Wed, 31 Aug 2022 14:23:16 -0400 From: Peter Xu To: David Hildenbrand Cc: John Hubbard , Jason Gunthorpe , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Mel Gorman , "Matthew Wilcox (Oracle)" , Andrea Arcangeli , Hugh Dickins , Alistair Popple Subject: Re: [PATCH v1 2/3] mm/gup: use gup_can_follow_protnone() also in GUP-fast Message-ID: References: <20220825164659.89824-1-david@redhat.com> <20220825164659.89824-3-david@redhat.com> <1892f6de-fd22-0e8b-3ff6-4c8641e1c68e@redhat.com> <2e20c90d-4d1f-dd83-aa63-9d8d17021263@redhat.com> <9ce3aaaa-71a6-5a81-16a3-36e6763feb91@redhat.com> <9a4fe603-950e-785b-6281-2e309256463f@nvidia.com> <68b38ac4-c680-b694-21a9-1971396d63b9@redhat.com> <4d067a99-1112-3b3d-bedf-35c1124904fd@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4d067a99-1112-3b3d-bedf-35c1124904fd@redhat.com> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 31, 2022 at 06:31:23PM +0200, David Hildenbrand wrote: > >> + /* Clear/invalidate the PTE before checking for PINs. */ > >> + if (IS_ENABLED(CONFIG_HAVE_FAST_GUP)) > >> + smp_mb(); > > > > Wondering whether this could be smp_mb__before_atomic(). > > We'll read via atomic_read(). > > That's a non-RMW operation. smp_mb__before_atomic() only applies to > RMW (Read Modify Write) operations. Ah right. > >> diff --git a/mm/ksm.c b/mm/ksm.c > >> index d7526c705081..971cf923c0eb 100644 > >> --- a/mm/ksm.c > >> +++ b/mm/ksm.c > >> @@ -1091,6 +1091,7 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page, > >> goto out_unlock; > >> } > >> > >> + /* See page_try_share_anon_rmap(): clear PTE first. */ > >> if (anon_exclusive && page_try_share_anon_rmap(page)) { > >> set_pte_at(mm, pvmw.address, pvmw.pte, entry); > >> goto out_unlock; > >> diff --git a/mm/migrate_device.c b/mm/migrate_device.c > >> index 27fb37d65476..47e955212f15 100644 > >> --- a/mm/migrate_device.c > >> +++ b/mm/migrate_device.c > >> @@ -193,20 +193,16 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, > >> bool anon_exclusive; > >> pte_t swp_pte; > >> > > > > flush_cache_page() missing here? > > Hmm, wouldn't that already be missing on the !anon path right now? Yes, I think Alistair plans to fix it too in the other patchset. So either this will rebase to that or it should fix it too. Thanks, -- Peter Xu