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=-16.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 0351EC00A89 for ; Mon, 2 Nov 2020 18:54:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7CD5522268 for ; Mon, 2 Nov 2020 18:54:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CD5522268 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D22466B0036; Mon, 2 Nov 2020 13:54:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CF8206B005C; Mon, 2 Nov 2020 13:54:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE78E6B0068; Mon, 2 Nov 2020 13:54:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 9392E6B0036 for ; Mon, 2 Nov 2020 13:54:52 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3F090180AD801 for ; Mon, 2 Nov 2020 18:54:52 +0000 (UTC) X-FDA: 77440380024.07.lunch99_3f04511272b2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 1E02D1803F9B0 for ; Mon, 2 Nov 2020 18:54:52 +0000 (UTC) X-HE-Tag: lunch99_3f04511272b2 X-Filterd-Recvd-Size: 4514 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Mon, 2 Nov 2020 18:54:50 +0000 (UTC) IronPort-SDR: Q9PM2oMn+VYmw9A2PRw2geuKd+zIY1j2zkTreB19fPcMKg7TphlG4rXK5QCI/3U1vGew7T9M5c PlhtSG4iPKhA== X-IronPort-AV: E=McAfee;i="6000,8403,9793"; a="156713075" X-IronPort-AV: E=Sophos;i="5.77,445,1596524400"; d="scan'208";a="156713075" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2020 10:54:42 -0800 IronPort-SDR: kFE+of5EwyezAmpLOP7R448QoTyBKhVpgGrjiAITlC/iq7wJeVW0ajfd3aF/k9+xp09loDmZHk R+ON+W0g1F9g== X-IronPort-AV: E=Sophos;i="5.77,445,1596524400"; d="scan'208";a="470480054" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2020 10:54:42 -0800 Date: Mon, 2 Nov 2020 10:54:41 -0800 From: Ira Weiny To: Jason Gunthorpe Cc: Andrew Morton , linux-mm@kvack.org, "Aneesh Kumar K.V" , Claudio Imbrenda , Jan Kara , John Hubbard Subject: Re: [PATCH rc] mm/gup: use unpin_user_pages() in check_and_migrate_cma_pages() Message-ID: <20201102185441.GF971338@iweiny-DESK2.sc.intel.com> References: <0-v1-976effcd4468+d4-gup_cma_fix_jgg@nvidia.com> <20201030205026.GC971338@iweiny-DESK2.sc.intel.com> <20201030235825.GR2620339@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201030235825.GR2620339@nvidia.com> User-Agent: Mutt/1.11.1 (2018-12-01) 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 Fri, Oct 30, 2020 at 08:58:25PM -0300, Jason Gunthorpe wrote: > On Fri, Oct 30, 2020 at 01:50:26PM -0700, Ira Weiny wrote: > > On Fri, Oct 30, 2020 at 01:32:28PM -0300, Jason Gunthorpe wrote: > > > When FOLL_PIN is passed to __get_user_pages() the page list must be put > > > back using unpin_user_pages() otherwise the page pin reference persists in > > > a corrupted state. > > > > > > Cc: > > > Cc: Aneesh Kumar K.V > > > Fixes: 3faa52c03f44 ("mm/gup: track FOLL_PIN pages") > > > Signed-off-by: Jason Gunthorpe > > > mm/gup.c | 7 +++++-- > > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > > > I don't have any way to test CMA stuff, this was noticed by inspection. > > > > > > diff --git a/mm/gup.c b/mm/gup.c > > > index 1bb349e5ed212a..2e26757f3c9276 100644 > > > +++ b/mm/gup.c > > > @@ -1630,8 +1630,11 @@ static long check_and_migrate_cma_pages(struct mm_struct *mm, > > > /* > > > * drop the above get_user_pages reference. > > > */ > > > > I wonder if that comment should be deleted/modified? It does not seem to apply > > any longer. > > It is still basically right, the 'above' is just a bit vauge.. Don't > want to touch extra stuff for a stable patch. > > > Also, looks like there is another place this occurs right before the call to > > check_and_migrate_cma_pages() in __gup_longterm_locked() > > > > 1730 if (check_dax_vmas(vmas_tmp, rc)) { > > 1731 for (i = 0; i < rc; i++) > > 1732 put_page(pages[i]); > > 1733 rc = -EOPNOTSUPP; > > 1734 goto out; > > 1735 } > > Oh, yes! I will update this in v2 - good eyes > > > And since we now have 2 places should this be a helper? > > I have another patch that deletes check_dax_vmas() and this code > > https://github.com/jgunthorpe/linux/commit/48ee608271e124e4a89353b9694502372c1b2df0 > > Does it look OK to you? I was going to check it again and post next > week I think it is ok... This code has gotten twisted a bit. I wonder if __get_user_pages_remote() could also be cleaned up after this patch? Also, __gup_longterm_locked() seems a bit of an odd name after that change. However, I don't have a better name so I think it is fine to leave it for now. It seems like the CMA 'longterm' checks are more about pinning but I don't recall the details ATM. > > Thus for this stable patch let's just leave it simple? Yea good for stable! Ira > > Thanks, > Jason