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=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,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 8E3F4C10DCE for ; Wed, 11 Mar 2020 01:46:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3E391208C3 for ; Wed, 11 Mar 2020 01:46:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="HOW9Wrvj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3E391208C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CA11F6B0003; Tue, 10 Mar 2020 21:46:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C521D6B0006; Tue, 10 Mar 2020 21:46:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B19E16B0007; Tue, 10 Mar 2020 21:46:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0209.hostedemail.com [216.40.44.209]) by kanga.kvack.org (Postfix) with ESMTP id 977E76B0003 for ; Tue, 10 Mar 2020 21:46:44 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 57C24180AD807 for ; Wed, 11 Mar 2020 01:46:44 +0000 (UTC) X-FDA: 76581392328.16.knot80_1da3932d0cb01 X-HE-Tag: knot80_1da3932d0cb01 X-Filterd-Recvd-Size: 8198 Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Wed, 11 Mar 2020 01:46:43 +0000 (UTC) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 10 Mar 2020 18:45:56 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 10 Mar 2020 18:46:41 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 10 Mar 2020 18:46:41 -0700 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 11 Mar 2020 01:46:41 +0000 Subject: Re: + mm-gup-track-foll_pin-pages-fix-2.patch added to -mm tree To: Andrew Morton , , , Linux-MM References: <20200307232517.0eSNFUWfN%akpm@linux-foundation.org> From: John Hubbard X-Nvconfidentiality: public Message-ID: <202efdc4-2b19-278b-9960-3afb18b8173d@nvidia.com> Date: Tue, 10 Mar 2020 18:46:40 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200307232517.0eSNFUWfN%akpm@linux-foundation.org> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1583891156; bh=fjFnAId9hSpJnxXJnClCPnks223zNMUI4CnP1pZ2WW0=; h=X-PGP-Universal:Subject:To:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=HOW9Wrvj7378cay/yDV2OejI7tEwY1QqnvLyrNUsPe73ogoLho0MVZMgLUBFlWzsA +kvH0QeX1SyaSifDl/oi99p1H6vxt1Ruo5oqyEi2LYCTet9yG27yoypkX6BnrrisNR g90xE+lslm+tS2UrVkHJOQflOeSS5VLQL5DxX9tGfgKzFwYssARv27Zx4r7wf6SaTe 0zDUpJvlAUp8qm8EhoDY2fdqN5SENXhP0ok2At8QzW2bQH2Nn6/UK6gtx/AfS0Gq1l PtiRqW9y/sNvv18fLKGia2lDzK+Ud9/DJUI9c0Nxgj6VmOiisnoNd/KiCcRKjWh52E mik6qSkBQgthw== 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 3/7/20 3:25 PM, Andrew Morton wrote: >=20 > The patch titled > Subject: mm/gup: fixup for 9947ea2c1e608e32 "mm/gup: track FOLL_PIN = pages" > has been added to the -mm tree. Its filename is > mm-gup-track-foll_pin-pages-fix-2.patch >=20 This appears to be causing a build failure in mm/gup.c, in mmotm, as of tod= ay anyway: commit 5d9ee416b570 ("pci: test for unexpectedly disabled bridges") I vaguely recall reviewing an earlier version that moved put_compound_head(= ) up higher in=20 gup.c, in order to avoid this. In any case, that's what this needs in order= to build.=20 Sorry for missing it in the review. Claudio, did you compile-test the patch? I'm not sure how this made it all = the way to mmotm without it triggering something, either, but I can't see anything obviously= wrong with my tree, which has no local changes applied. Here's what I'm seeing, and it makes sense because put_compound_head() is a= ctually at=20 line 2323: mm/gup.c: In function =E2=80=98gup_pte_range=E2=80=99: mm/gup.c:2177:4: error: implicit declaration of function =E2=80=98put_compo= und_head=E2=80=99; did you mean =E2=80=98set_compound_head=E2=80=99? [-Werr= or=3Dimplicit-function-declaration] 2177 | put_compound_head(head, 1, flags); | ^~~~~~~~~~~~~~~~~ | set_compound_head mm/gup.c: At top level: mm/gup.c:2323:13: warning: conflicting types for =E2=80=98put_compound_head= =E2=80=99 2323 | static void put_compound_head(struct page *page, int refs, unsigned= int flags) | ^~~~~~~~~~~~~~~~~ mm/gup.c:2323:13: error: static declaration of =E2=80=98put_compound_head= =E2=80=99 follows non-static declaration mm/gup.c:2177:4: note: previous implicit declaration of =E2=80=98put_compou= nd_head=E2=80=99 was here 2177 | put_compound_head(head, 1, flags); | ^~~~~~~~~~~~~~~~~ And here's a compile-tested (only) proposed fix: diff --git a/mm/gup.c b/mm/gup.c index 722fcdd32ab8..6344252f0632 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2116,6 +2116,28 @@ static inline pte_t gup_get_pte(pte_t *ptep) } #endif /* CONFIG_GUP_GET_PTE_LOW_HIGH */ =20 +static void put_compound_head(struct page *page, int refs, unsigned int fl= ags) +{ + if (flags & FOLL_PIN) { + mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_RELEASED, + refs); + + if (hpage_pincount_available(page)) + hpage_pincount_sub(page, refs); + else + refs *=3D GUP_PIN_COUNTING_BIAS; + } + + VM_BUG_ON_PAGE(page_ref_count(page) < refs, page); + /* + * Calling put_page() for each ref is unnecessarily slow. Only the last + * ref needs a put_page(). + */ + if (refs > 1) + page_ref_sub(page, refs - 1); + put_page(page); +} + static void __maybe_unused undo_dev_pagemap(int *nr, int nr_start, unsigned int flags, struct page **pages) @@ -2320,28 +2342,6 @@ static int record_subpages(struct page *page, unsign= ed long addr, return nr; } =20 -static void put_compound_head(struct page *page, int refs, unsigned int fl= ags) -{ - if (flags & FOLL_PIN) { - mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_RELEASED, - refs); - - if (hpage_pincount_available(page)) - hpage_pincount_sub(page, refs); - else - refs *=3D GUP_PIN_COUNTING_BIAS; - } - - VM_BUG_ON_PAGE(page_ref_count(page) < refs, page); - /* - * Calling put_page() for each ref is unnecessarily slow. Only the last - * ref needs a put_page(). - */ - if (refs > 1) - page_ref_sub(page, refs - 1); - put_page(page); -} - #ifdef CONFIG_ARCH_HAS_HUGEPD static unsigned long hugepte_addr_end(unsigned long addr, unsigned long en= d, unsigned long sz) thanks, --=20 John Hubbard NVIDIA > This patch should soon appear at > http://ozlabs.org/~akpm/mmots/broken-out/mm-gup-track-foll_pin-pages-= fix-2.patch > and later at > http://ozlabs.org/~akpm/mmotm/broken-out/mm-gup-track-foll_pin-pages-= fix-2.patch >=20 > Before you just go and hit "reply", please: > a) Consider who else should be cc'ed > b) Prefer to cc a suitable mailing list as well > c) Ideally: find the original patch on the mailing list and do a > reply-to-all to that, adding suitable additional cc's >=20 > *** Remember to use Documentation/process/submit-checklist.rst when testi= ng your code *** >=20 > The -mm tree is included into linux-next and is updated > there every 3-4 working days >=20 > ------------------------------------------------------ > From: Claudio Imbrenda > Subject: mm/gup: fixup for 9947ea2c1e608e32 "mm/gup: track FOLL_PIN pages= " >=20 > In case pin fails, we need to unpin, a simple put_page will not be enough >=20 > fixup for commit 9947ea2c1e608e32 ("mm/gup: track FOLL_PIN pages") >=20 > it can be simply squashed in >=20 > Link: http://lkml.kernel.org/r/20200306132537.783769-2-imbrenda@linux.ibm= .com > Signed-off-by: Claudio Imbrenda > Reviewed-by: John Hubbard > Signed-off-by: Andrew Morton > --- >=20 > mm/gup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > --- a/mm/gup.c~mm-gup-track-foll_pin-pages-fix-2 > +++ a/mm/gup.c > @@ -2065,7 +2065,7 @@ static int gup_pte_range(pmd_t pmd, unsi > goto pte_unmap; > =20 > if (unlikely(pte_val(pte) !=3D pte_val(*ptep))) { > - put_page(head); > + put_compound_head(head, 1, flags); > goto pte_unmap; > } > =20 > _ >=20 > Patches currently in -mm which might be from imbrenda@linux.ibm.com are >=20 > mm-gup-track-foll_pin-pages-fix-2.patch > mm-gup-writeback-add-callbacks-for-inaccessible-pages.patch >=20