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=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 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 CC7D7C10F27 for ; Wed, 11 Mar 2020 10:14:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 965CA2071B for ; Wed, 11 Mar 2020 10:14:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 965CA2071B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 35E526B0006; Wed, 11 Mar 2020 06:14:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 30E966B0007; Wed, 11 Mar 2020 06:14:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D5E66B0008; Wed, 11 Mar 2020 06:14:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0057.hostedemail.com [216.40.44.57]) by kanga.kvack.org (Postfix) with ESMTP id 01CF16B0006 for ; Wed, 11 Mar 2020 06:13:59 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 978D38248047 for ; Wed, 11 Mar 2020 10:13:59 +0000 (UTC) X-FDA: 76582670598.30.nail14_5d08102793246 X-HE-Tag: nail14_5d08102793246 X-Filterd-Recvd-Size: 7718 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Wed, 11 Mar 2020 10:13:59 +0000 (UTC) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02BA5Mf3139493 for ; Wed, 11 Mar 2020 06:13:58 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ypw1vtw6r-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 11 Mar 2020 06:13:58 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 11 Mar 2020 10:13:56 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 11 Mar 2020 10:13:54 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02BADrYo38666296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Mar 2020 10:13:53 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 90A8E4C04A; Wed, 11 Mar 2020 10:13:53 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 641AB4C046; Wed, 11 Mar 2020 10:13:53 +0000 (GMT) Received: from p-imbrenda (unknown [9.152.224.219]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 11 Mar 2020 10:13:53 +0000 (GMT) Date: Wed, 11 Mar 2020 11:13:52 +0100 From: Claudio Imbrenda To: John Hubbard Cc: Andrew Morton , , Linux-MM Subject: Re: + mm-gup-track-foll_pin-pages-fix-2.patch added to -mm tree In-Reply-To: <202efdc4-2b19-278b-9960-3afb18b8173d@nvidia.com> References: <20200307232517.0eSNFUWfN%akpm@linux-foundation.org> <202efdc4-2b19-278b-9960-3afb18b8173d@nvidia.com> Organization: IBM X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 20031110-4275-0000-0000-000003AA8F49 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20031110-4276-0000-0000-000038BFAAD2 Message-Id: <20200311111352.1dff2984@p-imbrenda> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-03-11_02:2020-03-11,2020-03-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003110065 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, 10 Mar 2020 18:46:40 -0700 John Hubbard wrote: > 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 >=20 > This appears to be causing a build failure in mm/gup.c, in mmotm, as > of today anyway: >=20 > commit 5d9ee416b570 ("pci: test for unexpectedly disabled > bridges") >=20 >=20 > I vaguely recall reviewing an earlier version that moved > put_compound_head() up higher in gup.c, in order to avoid this. In yes, that is what I had sent > any case, that's what this needs in order to build. Sorry for missing > it in the review. I don't think you missed it, because the patch I sent out to be squashed did move it up > Claudio, did you compile-test the patch? I'm not sure how this made not only compile tested, I even actually tested-tested it. > 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. >=20 > Here's what I'm seeing, and it makes sense because > put_compound_head() is actually at line 2323: the patch I had sent out did move put_compound_head to around line 116 > 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_compound_head=E2=80=99; did you mean =E2=80=98set_compound_h= ead=E2=80=99? > [-Werror=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_he= ad=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_compound_head=E2=80=99 was here 2177= | > put_compound_head(head, 1, flags); | ^~~~~~~~~~~~~~~~~ >=20 > And here's a compile-tested (only) proposed fix: I think the most appropriate place would be right after try_grab_compound_head, which is where I had put it. > 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 flags) +{ > + 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, > unsigned long addr, return nr; > } > =20 > -static void put_compound_head(struct page *page, int refs, unsigned > int flags) -{ > - 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 end, unsigned long sz) >=20 >=20 >=20 > thanks,