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=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT 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 5A988C3B1BF for ; Fri, 14 Feb 2020 22:27:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 19E722082F for ; Fri, 14 Feb 2020 22:27:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19E722082F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=de.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A31426B06B0; Fri, 14 Feb 2020 17:27:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E0CF6B06B1; Fri, 14 Feb 2020 17:27:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D0126B06B2; Fri, 14 Feb 2020 17:27:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id 6DC926B06B0 for ; Fri, 14 Feb 2020 17:27:46 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 154CE181AEF21 for ; Fri, 14 Feb 2020 22:27:46 +0000 (UTC) X-FDA: 76490170932.26.knife34_26a8e2c331227 X-HE-Tag: knife34_26a8e2c331227 X-Filterd-Recvd-Size: 6461 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Fri, 14 Feb 2020 22:27:45 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01EMP19d004936; Fri, 14 Feb 2020 17:27:44 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y5g8cchmd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 Feb 2020 17:27:43 -0500 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 01EMPNm4006033; Fri, 14 Feb 2020 17:27:43 -0500 Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y5g8cchk8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 Feb 2020 17:27:42 -0500 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 01EMP6Ha015199; Fri, 14 Feb 2020 22:27:41 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma01wdc.us.ibm.com with ESMTP id 2y5bc01xjb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 Feb 2020 22:27:41 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01EMRcFL58982806 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Feb 2020 22:27:38 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5E0E1136096; Fri, 14 Feb 2020 22:27:38 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 62341136091; Fri, 14 Feb 2020 22:27:37 +0000 (GMT) Received: from localhost.localdomain (unknown [9.114.17.106]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 14 Feb 2020 22:27:37 +0000 (GMT) From: Christian Borntraeger To: Christian Borntraeger , Janosch Frank , Andrew Morton Cc: KVM , Cornelia Huck , David Hildenbrand , Thomas Huth , Ulrich Weigand , Claudio Imbrenda , linux-s390 , Michael Mueller , Vasily Gorbik , Andrea Arcangeli , linux-mm@kvack.org, Will Deacon , Sean Christopherson Subject: [PATCH v2 40/42] example for future extension: mm:gup/writeback: add callbacks for inaccessible pages: source indication Date: Fri, 14 Feb 2020 17:26:56 -0500 Message-Id: <20200214222658.12946-41-borntraeger@de.ibm.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200214222658.12946-1-borntraeger@de.ibm.com> References: <20200214222658.12946-1-borntraeger@de.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-14_08:2020-02-14,2020-02-14 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=2 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 phishscore=0 priorityscore=1501 mlxscore=0 spamscore=0 bulkscore=0 adultscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002140165 Content-Transfer-Encoding: quoted-printable 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: From: Claudio Imbrenda We might want to do different things depending on where we are coming from. Cc: Will Deacon Cc: Sean Christopherson Signed-off-by: Claudio Imbrenda [borntraeger@de.ibm.com: patch description] Signed-off-by: Christian Borntraeger --- include/linux/gfp.h | 8 +++++++- mm/gup.c | 4 ++-- mm/page-writeback.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index be2754841369..a15fcb361e7c 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -485,8 +485,14 @@ static inline void arch_free_page(struct page *page,= int order) { } #ifndef HAVE_ARCH_ALLOC_PAGE static inline void arch_alloc_page(struct page *page, int order) { } #endif +enum access_type { + MAKE_ACCESSIBLE_GENERIC, + MAKE_ACCESSIBLE_GET, + MAKE_ACCESSIBLE_GET_FAST, + MAKE_ACCESSIBLE_WRITEBACK +}; #ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE -static inline int arch_make_page_accessible(struct page *page) +static inline int arch_make_page_accessible(struct page *page, int where= ) { return 0; } diff --git a/mm/gup.c b/mm/gup.c index 354bcfbd844b..ce962c155724 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -274,7 +274,7 @@ static struct page *follow_page_pte(struct vm_area_st= ruct *vma, page =3D ERR_PTR(-ENOMEM); goto out; } - ret =3D arch_make_page_accessible(page); + ret =3D arch_make_page_accessible(page, MAKE_ACCESSIBLE_GET); if (ret) { put_page(page); page =3D ERR_PTR(ret); @@ -1923,7 +1923,7 @@ static int gup_pte_range(pmd_t pmd, unsigned long a= ddr, unsigned long end, =20 VM_BUG_ON_PAGE(compound_head(page) !=3D head, page); =20 - ret =3D arch_make_page_accessible(page); + ret =3D arch_make_page_accessible(page, MAKE_ACCESSIBLE_GET_FAST); if (ret) { put_page(head); goto pte_unmap; diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 558d7063c117..f85148e59800 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2811,7 +2811,7 @@ int __test_set_page_writeback(struct page *page, bo= ol keep_write) * If writeback has been triggered on a page that cannot be made * accessible, it is too late. */ - WARN_ON(arch_make_page_accessible(page)); + WARN_ON(arch_make_page_accessible(page, MAKE_ACCESSIBLE_WRITEBACK)); return ret; =20 } --=20 2.25.0