From patchwork Thu Jul 6 16:38:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 116806 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2699470vqx; Thu, 6 Jul 2023 09:58:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlESFugVIEQw+B0V8PoCebLmtQB9tijBfRoy7+T90Oq4OINzSj+yuPoyGKHAGL9eIkXw1uH0 X-Received: by 2002:a17:903:234f:b0:1b8:7616:82d4 with SMTP id c15-20020a170903234f00b001b8761682d4mr2925120plh.19.1688662705657; Thu, 06 Jul 2023 09:58:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688662705; cv=pass; d=google.com; s=arc-20160816; b=G1e36swVFhwd85Cnd7C4mqavG5izOQq/9XL98wcwvJFLJZ/y4jRXoRLFwKGU2EUMTp wivAtixB+Y903EppLeaP0IAX5HNEjZmihU08bV7s/fmJ3vPRCfXJypIpnpItsNjftxX8 MoSdgKeU8yEiV0MU+Dl6uJ7mmbCRLqazdGFWFl3Gl++Mq5FDuqXAJdMZGN+/sMzUqsIw Lp3bM4QJFQmGcCkBUewvuAy4WJ/1LBo6BPbGPuK+diaTNGXggPnuPupli8ZahxFG8EV+ 3NdLlFYjMv22IC33g7NkVC8EoLCT7jHg579WRhKeif7B8O9MRdtS81W7p+OuZEa9NJAL PCvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=eKIMZ8ZrypitCIbtsj/aGplEfX/DSuTSYvIeZckxPqk=; fh=KAFD5kSwV1XwFKH8ka5uEp2GLJJFdSseJazm66P1S6w=; b=y9/qF/OrMxm6WqXfi6SZejK7NhFTTOdXMaWWCbtffr39BV64XRK7dXbyzzv+i7p5UA SmTTY2ASvM0ghOHthAggjXwQq2DJmhWsJ7/3VHYjp+EmFtSe8F3aaT2nYA5ogpPl1BTf v7Fj6FTE7nMWe30qA0EMH9tvFb3ctjlvDcUvlD6umvGjWqe6iDIJ2lhWO9G+lWrs1RbP w2/wVJ+dwj54ifnn7Ah1nhPjNq38oR1biju4+57tQUr1S5O6sjntF5S8N30PbDjU2z8M bm8cn3MTEDDAnJSv3h75iDS10Q463f5dOpe4+RmfE1HPKjC5yYNEZUFX3+NutOuXEGa4 OGoQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=g4dDq5Jn; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rl7QKATB; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020a170902680800b001b9075dbda2si307993plk.199.2023.07.06.09.58.12; Thu, 06 Jul 2023 09:58:25 -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=@oracle.com header.s=corp-2023-03-30 header.b=g4dDq5Jn; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rl7QKATB; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231580AbjGFQj0 (ORCPT + 99 others); Thu, 6 Jul 2023 12:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231532AbjGFQjR (ORCPT ); Thu, 6 Jul 2023 12:39:17 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 521841727 for ; Thu, 6 Jul 2023 09:39:16 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 366G3ntc002034; Thu, 6 Jul 2023 16:38:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=eKIMZ8ZrypitCIbtsj/aGplEfX/DSuTSYvIeZckxPqk=; b=g4dDq5JnoVfqyR0leYlZjDxmt7omyeIRziJcEWwWArejiAUG/Rg8U3ZmkxlXz0lk8kRy U2ztB0ejCDZDvWEJekcDf+p3sBaggyNQfEYlZhTNmrMr9Oz6xEK/dHn5YvC0tsdQDCk1 A2ZyuKPG7kd6JNxOWAehIGgra3Clhbiov47IQvr2Co/IbNjP8ZM7ydi2OpAP13GeAdYA 7rz4X2NBxUvltqAtoNO8J9BXUP7wUMm6bF5atX/fApcC7+KPZeFlggnCC5ScRD/ycXro BmOLgmyqD37VOUVWuDpMFumRgIWG7s/sGCErHicIxND6tauD36yOv8w53tyKP9WZw4us Gw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rjc6cs8v3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Jul 2023 16:38:59 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 366GYVLc010307; Thu, 6 Jul 2023 16:38:58 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rjak79pue-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Jul 2023 16:38:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CLEJk6i25N0Ogi+fPMhN6rttGNLO8Mxw31iuZJH80VfhBoqCeMpD/xF0mZ3PKsyu0Wuqc14UyOpkd/gTBPAFclU15ficqWbdmoxigs8ckx1ET7XRTPyXURgb/3j4ACzrXRwbuPszbwB8dVqgeXHRTwOsMGb3HpoXT0ZvZWiy3F8mqT7/BXJNiwZAxIjqcuXGvvi0g0zMbEGQxidZ8Ie3I7P38nhDjkRLio5X7BqvIE7X7y7QTWUvQxavdGw/Y2md/BJyPIB+q2zd3btViYvw0MnMNSrX9j329HCPx3OqHYBA2HuDAljAYWfXue1cnUI5C7zDGW2qDQ8alaZb0+V6tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eKIMZ8ZrypitCIbtsj/aGplEfX/DSuTSYvIeZckxPqk=; b=ZVSYQoYbqWl1V7scC1iCMWXc3IcODr740/kuQehNdqnLmRIbNJ6IQ3Qhkxxo0sU8MM26PiJshFbgr7aUJZ1vfBRUvXMsFME+E6GiaMVeh4jn60s3nUGFCQskM4n/jxhPzPfaJ68s4xuSgVg4Cp53wHKw8/gn0h+S0NnZJ1hebEtf7vx6Hd1MAokVblim2mvMIHpS0+uuPJgs7OL/GRC201aMRQf+lFLWtAm5mB8zKXkCNQMUMPp+6bq18zB1EaqEBEv52fwWCfLubf2+yolU1lOakUkLnf4fZc5pBO0GNoLqa51rdqJ9ZYZAB0PJ6nOTXh9Ai/UVFi73Igo7pMa6rg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eKIMZ8ZrypitCIbtsj/aGplEfX/DSuTSYvIeZckxPqk=; b=rl7QKATBt5aZK9pnKY2gBeRgieF+6cUVz21t48gexfrRMIcPsb60dfmcdzNh5Q8InECjRZsAb+bqfrjPcO+cZlwRCxmergFy64spgolxpPX54SgqP95+9wfsfM+Nzy1t1v3vvQXkZ3hpySIg29bMCoC8vVg07cK0oZQGAWmuRu4= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH0PR10MB4955.namprd10.prod.outlook.com (2603:10b6:610:c2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.24; Thu, 6 Jul 2023 16:38:53 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::d9c0:689a:147b:ced5]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::d9c0:689a:147b:ced5%5]) with mapi id 15.20.6565.019; Thu, 6 Jul 2023 16:38:53 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, zhangpeng362@huawei.com, Sidhartha Kumar Subject: [PATCH v3 1/4] mm/memory: convert do_page_mkwrite() to use folios Date: Thu, 6 Jul 2023 09:38:44 -0700 Message-ID: <20230706163847.403202-1-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.41.0 X-ClientProxiedBy: BY3PR03CA0007.namprd03.prod.outlook.com (2603:10b6:a03:39a::12) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH0PR10MB4955:EE_ X-MS-Office365-Filtering-Correlation-Id: d684c700-ade0-4b7f-3c43-08db7e3f7c21 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BleejqJnXvtp3hj/oketlswziQjQSr/mFZ2gj8kWeW8RhPWJs92c6G9i1+NfteA849KLR5ziQE3Khc58ocX7sUbWp9Ai8F/KF2GI0jV1TY/wWXgsE0o8rlBrHWXOj95zGYgGlY6abdmzpBEUM4+DlLUZWVwy14JwbrT7L8kEtyo7bJfvHJ5Z0Jj2NBriQOiYkzNzuZrF5jSj9g0HhtAIB8rp+owKFIOXKZ2UsZvNUx4HRhuv1BTAQgGgMPp7U6HebpIRJsbhih34pLo5bCPqah7k2n8kQQeM158ZFdaHTyXG15w11Zz+WFO/vabrOsD67d3AoIBw2OXvCVQaxtO/PN4NXf062EBH9wIoqwl3oRuWUufrXWRib9p211pszTpltcs3QfU0NUZmRZidTyuaTSzpHNoywRo1eVHv3MRF+ctFGUxZ90GSqEgaAojc0S+YPtNysUeMYvMudqdTQkBpDbrvywbQABSkoBK78zHGeVBH/BFGyY+WEyEij+l7RLd0A5wPk5z2tA2Mv7/qob+1zioDtZySQg4dPtLuLJmLwDFmgFcsdqqob/rNUw/1et5s X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(396003)(346002)(376002)(366004)(451199021)(5660300002)(44832011)(66476007)(66556008)(66946007)(38100700002)(4326008)(41300700001)(8936002)(316002)(8676002)(86362001)(36756003)(2906002)(6666004)(6486002)(83380400001)(107886003)(6506007)(1076003)(186003)(6512007)(2616005)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4+hB6oMRFtR9oNPAea09ttRFMvNLuA8hMQjcLRXelEEAOE9vfdYBrGRywPrjb1KvRnCZbMwJxrHn0vPitn0lDE8OXpAk2KsOjEkYENYSSHPCdTUwqXE1w+tihKFyBl5eytoVZAu/FMmJYmPn3w2FtUqKsp4meslBuEWZ/o4InvpD+bQj+1vY2Z7oZD2JzQHW6fRNpb5owrKoU/9tlNVd2IsUmijncubXlLaTDbrVbJiWgYsEjkIDz6bm4Dbez/bD62OLI7guQs2Ino2l495221w3umEHY2/Ewq2DrdE52UIa/PODTG+VwwKZTmQYuw1w8nqloYHYChVxNGEnTLfAJ2zeGabrjfXXJpnqALDbdiDwgnPmy+WzNqemT2A3AX7QLTNLLrbENJhU3ADl8cLiRP/X/3uW61KzH+yMRoDUYUiboHcWx5JCGBm9LIb5KVmDtLiNtkEFYqSYEdefe93kqXBK/94TEaMTDQsWXHVyLSm1zEMiHvP5v6/5LnRw50TPp1ZxqOezcF/S8/ExNBmXfLEZDfv/YVonMvX8SHPz4tUrGMe7gM2fK3VXqHacyvAtVoNYq0uasfWole6+elHlRxf8z3CrXp1JZJ/a5wHSij40td4FovLMs71Fv8Vt4zPsxSXxoICRfqhfajCAfGFcyAL1Q0sTeDW/KZ/MmKR7mOrM2eFi2Et170ZO56z4feZ3DzRlotnkfuCJFlbxcEPSYixveiEk9CeyAzuBMs9dB6VjKFtuRR05jeGvK3yBl7ETeONSLVqRHzn5FbHDQo2Hus4Bd+0Mqpcgn6EXFb0L4uWTfhCDyC3/ROXwSeNm/Ngk6cV2PZMn8eXTXRULNqTS2ZYweeLj7vdbHBjjWZdQEgVP5XQaTo6kPWaaHVJMyb9W6p2/jQCC70yUGdCbuICXqg3ehp0mCm1PD05wQpsvcB/iaBgWQPgAW+TNmLyuX3HQiNPSqBn8eVoUWHI8vNcDb7PD1LhN8t/wez3fKdloUVo42fleGRwrOnueNSuevun4dsuevzdCvWMW5IH+B9KZccFKcTPEHQmRW0cHL87RLIn7Q1fGg6avrFFFhJxvcUByXWIlpdwTyBI0aA38GlmjJ4qVzjeCjNtvXJ1fYpBE+D5Y23h5drzs/T9jnwl9J1zE543riiJusxgeCUciTxYNajHbL3n4mToydlPF+7Mm9Ykj5XA7tf7B1D2rTcPzk2Da+sDliwrnx4VSNoAyP3FRLRZAAVmVcamacaxIUZYoAEOHmeQHMe3vyM3WzZQxQviLM/BvFiwRD+ygjxhh4IOAjvXc0K25iM6Qy3PlQvfQDmIbZ+LKLax/nq7IDNj3wTrHro+mOHHNj5eDLSTMxsRM52wunaPX+d0WG1xi5QfV4pc/HhTJTg2rfO1GfKDxPt3Py+c2pp73rmeBUBMkgf2682dWWX6ywzVM0OYywuD0eqORIboUwKQPkiWa2a5/NcNtpG9kNN22Yvyr68f+B2Vj2Fcgk//Dga6sAp+K0FW0ZYgT+JQllE+GdjL3Pn41tdSmcVfqj9b7PWYDHwwlXKIEYCL+OQ42bNajEdM+nbBUcqKp8hygtEV1ZNRErfPDbmvya0Fh4MqgXDngxLnnC9soSDdoBn5IHIqQ6D+RB0JVVhY= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: qwe3piIttDKpdG9xx7iPRT4D5ukvTEDEFtmtA8Q2vKWxWPjYMOFZTx2n511kFjGd8e7Fwe7RyUqgn6Mbxx0aDlFvKIk7OX8BEqPhWijBOVAKOxBwmJdQ6ixIRySdk674v9gsW3tq+J/y3p4rEcdGwQqxQ5s7cVF4Sf35UpiaWTF5XcIrwqMvHOOrZE7wBMVCh1uNLmZ1DoScpC3UwEGlANutMh7dLIxskCTIjw9w/emu83CWWqJCjiDDjA8TlwEJ6v44pS2H3veUx3mRfLh0onLQ0ZjfyVnw8fdMv100yshtDuw6KD66tXUzYFd7/k7O4MOQYc4Th3QEmva28yfppS7IpB6TqlTCQxPpDKElWqLRx3R/JPH7gb8s0nNiYx/9KgiPJb+ErRG1Q1grjaV188iScK210rGwPHYqLD2VH1iWWVEau/zGu2iEOcfVhw9nWboSfU5L8H5EebWvK5It9+7XfZBLMtPvtcs5Ei1FU/WYw7muglQNyz3sPHv/6zVHY4qX/Bw5mi/rJDsz3B5C4BzKcGtmPWPyWF6IVz+aIIM7fpLCnj5jb/gTurJn78wbpUvHCq/SQY8/j8dVRxg5WsIELRpPE4jMe6SQe3stwyCTX4IblvcFPW4z+MS8VLxzAgefZqNx7YQXXjB890t09IpfYsyCelChHZ3PvfBPlYMMskSba0zfjxH5Y06ruiitUqfjN2QXaJfonU2MwJunM1xfvBgEVyCobbIRVE/EIBx7JeFFg+o3MgLqYXkFNFA0PWJhaw/eiX4YaNg7cPcQ8o70An+7OaYIaddKLVS0FAisiu7fuKQp/Gx5CCQq68tMwSVwWfC+Vsai6xLfriaKBOp+O2657LMHbyehDCXzziWNd+tNLEST0OHbbqEjjKK/NEJnnRPOyI60/HspiN6iGA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d684c700-ade0-4b7f-3c43-08db7e3f7c21 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2023 16:38:53.7378 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ysyUiLLLrxm7euWYT/q5+oNxMAhD30vbgMRtudUVhpHHRYW2nNoCEjKaZrWMNy2u03IHmWVp1sXorNCdXTxas+2eIlaC/HOhFPNB+0n/zPw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4955 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-06_11,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307060150 X-Proofpoint-GUID: 7_DHzLf13NVVQ-V6wrw5rQELKiThzpPx X-Proofpoint-ORIG-GUID: 7_DHzLf13NVVQ-V6wrw5rQELKiThzpPx X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770691185225411858?= X-GMAIL-MSGID: =?utf-8?q?1770691185225411858?= Saves one implicit call to compound_head(); Signed-off-by: Sidhartha Kumar Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: ZhangPeng --- mm/memory.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index cf4ae87b15639..1736a130fa829 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2935,7 +2935,7 @@ static gfp_t __get_fault_gfp_mask(struct vm_area_struct *vma) static vm_fault_t do_page_mkwrite(struct vm_fault *vmf) { vm_fault_t ret; - struct page *page = vmf->page; + struct folio *folio = page_folio(vmf->page); unsigned int old_flags = vmf->flags; vmf->flags = FAULT_FLAG_WRITE|FAULT_FLAG_MKWRITE; @@ -2950,14 +2950,14 @@ static vm_fault_t do_page_mkwrite(struct vm_fault *vmf) if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) return ret; if (unlikely(!(ret & VM_FAULT_LOCKED))) { - lock_page(page); - if (!page->mapping) { - unlock_page(page); + folio_lock(folio); + if (!folio->mapping) { + folio_unlock(folio); return 0; /* retry */ } ret |= VM_FAULT_LOCKED; } else - VM_BUG_ON_PAGE(!PageLocked(page), page); + VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); return ret; } From patchwork Thu Jul 6 16:38:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 116801 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2695488vqx; Thu, 6 Jul 2023 09:50:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlFDgT+Lk3WzCShgCu+aCf6pjrOAjgWRcwNaaIlWBX+yTVBJ0ihPLzHMj2Yyt8pJ/x1m4SBr X-Received: by 2002:a05:6a20:938f:b0:12e:caac:f252 with SMTP id x15-20020a056a20938f00b0012ecaacf252mr2359892pzh.1.1688662245479; Thu, 06 Jul 2023 09:50:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688662245; cv=pass; d=google.com; s=arc-20160816; b=ougSn4HXpAjvzwLKKwgvCGO9UWb9UkAplvTHIRWrwTLFJ+l4KiBoXazmNtjvYowAFT U47QZCs2ed10A0/PMEJiacIUqHn/j6vmxp12NYOZmfKrtTprLaZpNf6+NJz/0siqwjgl u6I6LYyJaj1u2SrJkWtbivC8NGCemGi0cdWwGEdbKRtHmTR2Jz2ViSoHRMF371Hacfmt SP4LR365EftQGrpqFhhDu0ARRnwwsHC3tinnGC2JnB14z6zBGts59SRSSBJ+PdBDfX5I hnrCIanrq3NVXl/teA+GYaXBJJNreju7yIYX+bcLnL1tTiaurLRQdKS0MVa6e/3y5bME feSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=La4Z+lKIizNK9+LMU6kCP/9Il0w9pgqeFSQkREsDHrk=; fh=KAFD5kSwV1XwFKH8ka5uEp2GLJJFdSseJazm66P1S6w=; b=X4TxlnnyV434qyzxA9+K4zBtCDgIFiJGnaYyWyphcCnQG3EcBpXVWtgaFUditK5gVr u64awP/hLA3xwxMODWFLuI3wOwWcHwEpCmZ+WFi6h19uJ6VD/kN4S19AYcfOeUSgo9G9 MQQEmh3ZCmCpMwtHG0KM8r6B4STRm2NTAQff9kMbaDedEuCaBzzq0IUp0yAqxzYHCDVB J0lv39lCItU/tiRJjgiJqRSENfBVj8P/iG7mKe0rLU25aimRlWTaCaaluuUDSEDNOyN9 KV+BhvG2Moyf13wMp/mY7MNW6VMtGqqvBS7rdDhEnRV1Jwksz3wxoRUgZMFf9iTSGf0R XUmg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=s9OeMNGO; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=fIIHc9qu; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a170902f39400b001b89654fa42si1495399ple.476.2023.07.06.09.50.31; Thu, 06 Jul 2023 09:50:45 -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=@oracle.com header.s=corp-2023-03-30 header.b=s9OeMNGO; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=fIIHc9qu; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231627AbjGFQjX (ORCPT + 99 others); Thu, 6 Jul 2023 12:39:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231315AbjGFQjP (ORCPT ); Thu, 6 Jul 2023 12:39:15 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C54A1AE for ; Thu, 6 Jul 2023 09:39:14 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 366FwsIw014172; Thu, 6 Jul 2023 16:39:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=La4Z+lKIizNK9+LMU6kCP/9Il0w9pgqeFSQkREsDHrk=; b=s9OeMNGOdkBzISh76Oc+Qx2yth+NcVeysr9qqQ/28+dXo8Fvio6eVRYiEXBH9Q9F852x 9RK3IoId5453w6poqLYqt/QHFJtefML3NdH4KhorSsCMLsF3HiBEH9d52+Q91g2gfwjK 14HohvwFE1rHUZZNsh44mKp2RsUYVCpiwFFu3iTrC9VyvLrOQYTDhm4LdV9dObn3zrJp s+W5fWqEkL71xd8mvd7tE3rL1xexJQL6TzNtVU7aZzdwjFJqe3N4J6zL77u9n99rdQQg GKxdTyK3OBpm0vbqlMP/PQqpeTyaJDYFZAw7IYLNj1Qh8wRXPlU6ugPk9WvYTTm1Fsd6 ug== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rp0nw03mj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Jul 2023 16:39:00 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 366GYVLg010307; Thu, 6 Jul 2023 16:38:59 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rjak79pue-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Jul 2023 16:38:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GNkMpMpbsQgomKgO/2T4nfVhJqXN+IVTpA2aelX8rKqPxrn5f1Ptc0+SJ1bqvRsc3idfSJvNk0jZx9fE/gQAWTan/t2uBWwwC21z/Qh5tTpVG0fEgdi2HxCxqd+x2Gm/8ZmPKgh9CwT5CrvVFxJDt5P+7Z3QU+0Y8zEVBMIWPWXCgMsy5RnxQhIa4TOV/iAlXOHVINbLdFPgNLaKUARrCdGbD1JZ/rxqr+cQsWhBMj8TrBpmWLGvdrD3M7rPmsdJyz1TrzUNpRgB4VYcA9QqR0bJUbcJhB0Kk8vVrzBDkb542K/M/3E2RlxB7MXmEk3n7MbB6Gz2dpSI9WbyY/9dHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=La4Z+lKIizNK9+LMU6kCP/9Il0w9pgqeFSQkREsDHrk=; b=mpeL6WyrQ+5Mbf+qtUXd6AakX2vvyCP1F0viUHatXxbY1hZwlUR1BAqU3vg3ZBNxUnrflDefNq7Jvl+So/8Zn9JXx0QU6Io88rhvqc/tc0Ys2+1QOQcehM48K3RJ3f0VPJDPd664Ta/ghaSUON9lsuYwe6WQixORyIYJRYWBScidUeuuRPd0bc9nganbzlnVEfrhoCHs93cc/cGa6V2GoyzZ7JViT4Wi+4Ck0cLcYrqiJgYGmrmuK+5YhW1R4fCBmvpJAiU1g63zSrVuaPT7eGwiFwHoB1fmpPTa+CS45TELCeV6xNors/wim2H/48UmultmKWpIExvQZZTVOpv+eQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=La4Z+lKIizNK9+LMU6kCP/9Il0w9pgqeFSQkREsDHrk=; b=fIIHc9quLk8cQxTFKlECYBOWG35cK53Z/nfsDk78w7An5hMVloKMkwB8zg8gRStYPr1ryRxtjBac/zRiGmzhtMTW5HnOoTXrv0rHILbJiJtHPaewfohopqtpBaBPW9XHPiBRisAYHn5LOvXWySjs65cIq29pcNBgvJ7RjEKwBsI= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH0PR10MB4955.namprd10.prod.outlook.com (2603:10b6:610:c2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.24; Thu, 6 Jul 2023 16:38:56 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::d9c0:689a:147b:ced5]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::d9c0:689a:147b:ced5%5]) with mapi id 15.20.6565.019; Thu, 6 Jul 2023 16:38:56 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, zhangpeng362@huawei.com, Sidhartha Kumar Subject: [PATCH v3 2/4] mm/memory: convert wp_page_shared() to use folios Date: Thu, 6 Jul 2023 09:38:45 -0700 Message-ID: <20230706163847.403202-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230706163847.403202-1-sidhartha.kumar@oracle.com> References: <20230706163847.403202-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR06CA0024.namprd06.prod.outlook.com (2603:10b6:a03:d4::37) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH0PR10MB4955:EE_ X-MS-Office365-Filtering-Correlation-Id: a6c958b8-95db-496e-3a57-08db7e3f7dbb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PpUh+5NdLaHK1h4YNoseqVi2fYwg3kLiaL1X7t7V1uwzNvBqzOtOyWzGrnwTZQd88L8dx8pSOU2K5w2znep+77xK37nO/Qu+VUuzhwJvKWsVsrqYktLkZDVSogEX6g3TqcssxNb6H4igO8RA14StX/a6MlpT5okG2dr/2ZkogFp2uT+8xze7RK9qAzwFX2/cdwsIrzLkuINjp7qZIr3P/Y5gvRfY123DmmzQM4BqhpDEYZKbB7nkBLwAjJfctVFn/a+mCDpfPczu+F6h0vp+hQQeGkpmPQ0kpJWorinUW50hW7EX8/S8CbEMhrH8cVG8qyiIqYaPKIMDpdg4lOd/gKWWEx8ht1PBhBBSO5c9IPtbpv6qpkEjlymOGHSLF4vG+ki8Ea51ElvGwiFVL11HAgZjVFOu6acY9jcGw3zNnjWAST4WYmvBa78jNqgPOOA4W5AxNTrzVQc7jLPSCt30KeTOU/uFGyoMx0mxryGVmI7VSvaLetyfd5mtbCFG53MSQfq3nxfCuCY+Qlh00yGavcf/1gTM8fSIWUABxIdd6bPgNgyWQgrSCX+8RAa+Q88k X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(396003)(346002)(376002)(366004)(451199021)(5660300002)(44832011)(66476007)(66556008)(66946007)(38100700002)(4326008)(41300700001)(8936002)(316002)(8676002)(86362001)(36756003)(2906002)(6666004)(6486002)(83380400001)(107886003)(6506007)(1076003)(186003)(6512007)(2616005)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2F3/QA9OUtXUXpl2Pv+chwn+CX4Md4nuTp2oTiilfIfBuwe60uwOu8EOn8++zNgi5b8pe6pEpfu7f6RB/2X74/rv4/ZksEOeApjRhIVtJjL/WpF7as3gvR7z1/DOVlXKYdjJVZKB7WQT0Z5PtSgSKUHZCv0A8hfDPPcYHaID8z2Jzy+mx+lS6qDBBT94fT80mBrOg8Jo6gln8cFn6COPawD8qLBJoodyLg16bxWhpRLWAW1Xglw47Pc0aQWrgz+/Z6cwnBVWcQV+1yHVB0sHjKu3zNKfVf8T2Zpd2fxCFLfqj2OeYsrwdQz/pWeT4X1X+7O/9AwPE4fA3+eonXaeRjJO1+i/ViSwQR8RGNvJry6ehpEUYcmUJOtOEgpXMi0FAvi8giJpnQU4CEV7bb04xyPqCi6cRhDt4mp80Jx+5VtE5YzGZaWUlWNxiVObdLHshkC/5i12dCLQTWvVG8nG0mdIWPXX/PT65Qq5KLMF+xpjaBRCF5RqK1ScywVVavAPZAbk0PaMaceLnkukgaQfbyQP9Tsg5pMofRafVvlMeRoISqzG3imVlNZ/eubEqQAvnUf4+PKg9xs5rzjNqoBiBjpSTo/JYnQ7/LXqZ5tU+nDcC8P+skB4YD5JzMd3cIjUuxn/zWWO1dj9uwgsee0BgstZCRnBUqkiKMo6mFpoIJwpQMbWJxl6+IXJfSdAg5bmMEq13tfLqRNe7ohfuvom9WkFMALJyTnHYIS5Kdx7NNdjCQJGrZkeL/kv3Uba9LLm/MzwqI9jncQ52oJQtg3uSXBsHMM3KfRCp4eYWq9RncHTt64JrQs9+T6/QxVPHqQ8L9Mo4BQHI4lOI/fVVp12dm4ymsCfC9zStgKJoB2tb+O7QFKst+Slrvo6zmk9fXpP/Y5MSMgdJTxD/8OViYc617QTu8i0+cFSfCGxjJUKiOEEAbEgj+HMNEwwYcuLWXaUwnuoOIhC/igzM4liEvr54UCsikwnGOE7RXNrVS0AHlBaoyGGVAZNTPCK6bD9DN+kx4HLXEk77obhPUfC4bOxZP6e+3nodFIXixIovp/Pz//sBcMgR2TvlTWegsvl0udsJXIVVyr2cLOnSY6jGtA2zsQL3Uj7PScKThJGCAUwkI5lMH9WpPwAuEhLrTU/3mpqsdnDwOfX88SqsLw1ouUV/QE3uogCfgmPbA7o3q1bX04e0Sg6g6tqnQZH4xOP+ad/BKYnUJpmgUMEXMqHNRL9+ToI3hDT9VX1kw8NvyYMehu+c8l975H41DBQC/7cm15OXVBwjQuGh1pws+PaRkNTLpjmWuGFg4KUE9lfVSlGo8hjTCKE2tr7djsXdVyZ8YZvJkzRDGfpesqcvvM7BHOGG3i3LD1S9H9nqxQki2b58KvQhjD1VEmDdbgUnHPI8Hih95BHrU5+MzUxacN5tNMizMJ2QCa8pLM204/dpiLX0SuI07umQXlcfXhjeTVQBkv32SkLKWERQSL9kSEXaElzW3qJP6cuo/hQtCxWKpo3zh9TphXMexC0Zd5pCanx4BizBdp0nqvuq2nSOPGaDPZclgSeZbnrQF3wrVUnFoKyKcUS1C0WJljw636ULc+DZlH230Zq2ar5uITdwWYK6W1f9mxDWLi4cTUVkvX8e+aasTY= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: gltjr4x/81QellTs1z9Rz8yOfu0+8R1BOp4UDQw1W8hzZkZSe/9oUP33duSsbL2Oqft+SLG4cPgOod5nQD/KINvlYzi+BcrvQYnVHmVKMq03W51PHCvax9At1oEF/iNTgNCbqqbOTl6awrgN/FiPa9UOif6NP+SNOWDEqF7bwYV9wKf+g7vz9gv64qg2FqDZfahnM+vdC/cb9+QNaLYG+uHamKVuFpB993jIRiOuxQxmk5nGYXBenlMQcjHJdqsWB25rok07EboAFfwuy81ZOaRZHHeOynKj9YH1hUKGKhaE6z4fD2r82Ob/3rcy16073xV76REq4aidDrxSzBXCaZGXTCFdxTX64zAhL182YZ+uRIm+3wfW5S57GbrsOwGFYH0EjITL5HRYO/2P9WpNw+30BibYoL1h+IlM3fcz6Uibcl5EcuMpd5IvJ5IuaAn5WKJij0LF4y0F/gUY6vEEs2pFPrAy+3f07m2deoSo6EzzmdDH9RUi2G090gMxdHxSpnmuPa5yXHOp7AQgq+qFMgO8pHQktBNyEdJoyGAELnG0NukU+3cUd0VUBuPoLPkaQZk6CAVBofE6cyjVjrVJeOU2bw96wpNhM56sPZzoLFLPxUauU6vYHtBmpR4mKF8Mn3HuI3B1q6Cv9Au/EZfR9slUEEfh2+l7/x1oJuBKWxMzvf21Ej9yvvfn5w5FODvTHfaNkMxGJcJ0foPWKcOyFBgex4xlM0cFibn4jfdqUgmLQln7/QsIMqFACB+ZBOXoCl6P0jxQAqgQHki66Bf1jHJi792yXKVmspXB6L/E3n1y02J+1FRBn5PKqmj5srseroZoZGx7uGYsRkjqcTu5UNbRaWFLn907plg9jtobweqrUcOAittzjStqyqTeT56Z/iIf25bjkKuzy9cXKbPIBg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6c958b8-95db-496e-3a57-08db7e3f7dbb X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2023 16:38:56.2418 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tU+iqB6ttr43aJwO0j5V47jbr6nZx+G2ODcK3rgl3qaGHHXEkQlP/YXw6Mm7oQKNKQ4/OxHKoc2W2kXzI5SuHUwLbIa7Yid2UJklzbmuH0E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4955 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-06_11,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307060150 X-Proofpoint-ORIG-GUID: 6rnXGtSvtB2SHbdrWX9tGa16FLQlmblg X-Proofpoint-GUID: 6rnXGtSvtB2SHbdrWX9tGa16FLQlmblg X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770690702737768582?= X-GMAIL-MSGID: =?utf-8?q?1770690702737768582?= Saves six implicit calls to compound_head(). Signed-off-by: Sidhartha Kumar Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: ZhangPeng --- v3: - remove extra page_folio() by moving up folio initialization v2: - change function definition to pass in a folio mm/memory.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 1736a130fa829..673b9fa67d0d7 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3285,13 +3285,13 @@ static vm_fault_t wp_pfn_shared(struct vm_fault *vmf) return 0; } -static vm_fault_t wp_page_shared(struct vm_fault *vmf) +static vm_fault_t wp_page_shared(struct vm_fault *vmf, struct folio *folio) __releases(vmf->ptl) { struct vm_area_struct *vma = vmf->vma; vm_fault_t ret = 0; - get_page(vmf->page); + folio_get(folio); if (vma->vm_ops && vma->vm_ops->page_mkwrite) { vm_fault_t tmp; @@ -3300,21 +3300,21 @@ static vm_fault_t wp_page_shared(struct vm_fault *vmf) tmp = do_page_mkwrite(vmf); if (unlikely(!tmp || (tmp & (VM_FAULT_ERROR | VM_FAULT_NOPAGE)))) { - put_page(vmf->page); + folio_put(folio); return tmp; } tmp = finish_mkwrite_fault(vmf); if (unlikely(tmp & (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) { - unlock_page(vmf->page); - put_page(vmf->page); + folio_unlock(folio); + folio_put(folio); return tmp; } } else { wp_page_reuse(vmf); - lock_page(vmf->page); + folio_lock(folio); } ret |= fault_dirty_shared_page(vmf); - put_page(vmf->page); + folio_put(folio); return ret; } @@ -3365,6 +3365,9 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf) vmf->page = vm_normal_page(vma, vmf->address, vmf->orig_pte); + if (vmf->page) + folio = page_folio(vmf->page); + /* * Shared mapping: we are guaranteed to have VM_WRITE and * FAULT_FLAG_WRITE set at this point. @@ -3379,12 +3382,9 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf) */ if (!vmf->page) return wp_pfn_shared(vmf); - return wp_page_shared(vmf); + return wp_page_shared(vmf, folio); } - if (vmf->page) - folio = page_folio(vmf->page); - /* * Private mapping: create an exclusive anonymous page copy if reuse * is impossible. We might miss VM_WRITE for FOLL_FORCE handling. From patchwork Thu Jul 6 16:38:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 116805 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2698524vqx; Thu, 6 Jul 2023 09:56:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlHUoObFsDmrslKr438fjKfB57v2JNrQmpdwiiWf/HYNUQyZN6SWyPniJurkR029OBknoh4I X-Received: by 2002:a17:902:758b:b0:1b8:1b84:93e5 with SMTP id j11-20020a170902758b00b001b81b8493e5mr1964772pll.1.1688662592194; Thu, 06 Jul 2023 09:56:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688662592; cv=pass; d=google.com; s=arc-20160816; b=FOwbf0Bw0ZvX1CseGs6xPC1DEyIHxDPvmG106J0zpIzyXXfgtv2TRnJBkpoJdyKnFx SXTdGMltI3xEXZhFqVaJsPysPOi/1wPjVcc+1JuyC2HFPITzbv0q/t06vjm6sRMG1Iir uPyq4Ze2BKAtTZYLP1qO6IxUwamoJB6Ut6pVyXCkHnPVsnrqFcWjgCXyjhSKgc5+C0LB HEDs0XXo3fvYdIiVucbGuFx9yZ/SIhV6BjzlgHNLHs5kUbUkWDUfJLh7EZIZMZyGifG1 4ESuiNqu+Mo4/Zkwv9WH0kbiuj3b0sKmbYiRqvKSHjgxbJAGnvyDynVCjBKvUFFdZu/B q+IA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=csBh4HSSzCMWoZjVgLKpsMLNsrSVfG4zddz20S1OWx8=; fh=KAFD5kSwV1XwFKH8ka5uEp2GLJJFdSseJazm66P1S6w=; b=Li+Gz3hg6cvYkH0q2bdyUj+YTshHfd/B3mtHAqHnJ9U1ptHdMgs3e0X30AlctVzIa0 9e5Gtc8XMleVWhqJdjy/X+9e6yu4/Scq7xETckqOjVeRqO0fc0dHH74mTMpCVDljC1V5 HdJUgG9Bh6d21nT2AnfIsfktoBHcP+9+G31YklUCOKxKxqXRjBZPKk0WcJXRVpbuFlY0 nXTjzhfIoDMKhzLsekHl0lFP9QU0EOGli6wcnSmY8BWXPfmEx/dXvy+5JF/JDQeT/dIn X1d4DBsXrMfCNpbA4/pCm0YxJqlpk+QYGONOZk+KrarwNXackUIhXn+3P/z7OfDYA360 0K4g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b="JYX4imV/"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=q3GIDNRb; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020a17090264d000b001b3cd9079basi1696495pli.118.2023.07.06.09.56.19; Thu, 06 Jul 2023 09:56:32 -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=@oracle.com header.s=corp-2023-03-30 header.b="JYX4imV/"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=q3GIDNRb; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231703AbjGFQkG (ORCPT + 99 others); Thu, 6 Jul 2023 12:40:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231675AbjGFQkE (ORCPT ); Thu, 6 Jul 2023 12:40:04 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 515871BF8 for ; Thu, 6 Jul 2023 09:39:45 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 366Fx3m3012997; Thu, 6 Jul 2023 16:39:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=csBh4HSSzCMWoZjVgLKpsMLNsrSVfG4zddz20S1OWx8=; b=JYX4imV/LuV4pBfvWryXHZJjX9WN8QQ38DXmrfeKifaYk8kt3Nb0VwmXbwl/Ojth6TZr 0VQMKqWkQXzLzfsxODl4vk9r7gxSMsp7GewIexvhVWpWP4F3wwH0Jj4WibloGOzOCxWr 7KYx2YQopJUeqeRtj0HjgXQDtTmE/nSk53CWgx76ljYDBroCeGROb7CqxU8f47ksEgfr gQUFDLYFzd9X8Wkcw29Pzr2LRp3YwJnMm+Dtx1S4kv8QfPd0bcUIDDDvC9bC8fO2eVRz 8o1P3PGqssVmtQnVUxWSX3K7a9p9QyNcqYNtkrM2ZOT5mkDV5O0YwEcRvOtpNjnVdGCT wA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rnx8jrjmy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Jul 2023 16:39:31 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 366GXnsH013569; Thu, 6 Jul 2023 16:39:30 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rjak7av8n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Jul 2023 16:39:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UAEyde2tffHN201Ivx4XH0LNHCYOjE0DG/H37g0bPa7bx3IohT03fS2uLr1eMRNITbeed+fENGBwYzyEatDcJjlHXqObi9lfkfRA2d93JxAGvupgspyO1GBg2TNXtVfKxS3CVt+3gqLECARk2mL0yUaexOlVs90luuPb3r99ktQivTKz2L7d5ltFFCAGWhhKvmW3Qp0IY/Lt0fyj3XZAKWs8QQfSJKO0i/QWUEcQseoCSfxscmHXlVD5CgbGmj7ZGEFWFntNn+6wNWwP930MktXJrxzojI5sspR1dpQJS0FDn7BerOypoKXWReOJpe/DUxIcKV0/5HV3RIy28OGeDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=csBh4HSSzCMWoZjVgLKpsMLNsrSVfG4zddz20S1OWx8=; b=Z/Wy4wcvlZVraNbFsFtVbb59OQtpUxcbinnga5X9IOSYOkktwMeyaDJ/7Avkel7oeSc53CtFEW700hwDqnctBFHxete8RTjmbeFYBlf6iVJIfPi18L9mG993MLNbwf8GamyCTYzaFQvMExRy8wtH3XTdEi2Ews0a5ipllIju9CH3GAfjTpy8MjxvIkOLULM1kK4xYuOJKjFcycdCTksFtK0Rb93tSK9Wso/DgOSBrVIMAO43VkIB0WlkYGQJN0Dt5SoaA5VFcVaCdkqG7mQBWuvAPQ+RaoAYxP6uKWHCkLFD39xFW9MOqfFrZ4avGdwUIWoj8ALtUUuA5K5V122vVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=csBh4HSSzCMWoZjVgLKpsMLNsrSVfG4zddz20S1OWx8=; b=q3GIDNRbAKczIukMNcI549KCZ7/7erJRep0yMSk24s0uups/ctkhF0lT+RLxnDIrnEv18qaHUNA8m2QGWlfE4nXifhDY7++/vk/4Dg2w5GcN3+PTEj6vE2g1+4r8Kn44pRyGe6VjU2mBrGl20TJVXqxh1G57z+ZHcMTWqFP8tZ8= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH0PR10MB4955.namprd10.prod.outlook.com (2603:10b6:610:c2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.24; Thu, 6 Jul 2023 16:38:59 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::d9c0:689a:147b:ced5]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::d9c0:689a:147b:ced5%5]) with mapi id 15.20.6565.019; Thu, 6 Jul 2023 16:38:59 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, zhangpeng362@huawei.com, Sidhartha Kumar Subject: [PATCH v3 3/4] mm/memory: convert do_shared_fault() to folios Date: Thu, 6 Jul 2023 09:38:46 -0700 Message-ID: <20230706163847.403202-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230706163847.403202-1-sidhartha.kumar@oracle.com> References: <20230706163847.403202-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR16CA0022.namprd16.prod.outlook.com (2603:10b6:a03:1a0::35) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH0PR10MB4955:EE_ X-MS-Office365-Filtering-Correlation-Id: 2cd6d229-86d3-4c9c-120b-08db7e3f7f6d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PenC84z6mWtPU2HnXAeH34qf618yBoAGGHrLc4gHIV2jy2yJGrAa9TtiRFCjqLsrmXA4gzDCg04vSqoajLSnH0V6+ysklKvs/5GQ+wrCfCBfgpdIAqDhFNL2ZqJKirGfYYpeliXJCRfN2oG6dNV7NsIXoot5Ju+ADN6WqFwyFT1R5neogrwT2Hl7BR6wmkKa2iR0b1T3O9zonxmiCWdoFv8aTGu1ePj34D8/qrN9oWO4Z+FXoJ+2j7ZJzIW8g774WHTNMMzlPiTGuTUsOxIXqpox7QnZTvKKEHu0l0l4REiGi4RM3HK5kIQFVwn9ieVHouddXBXhMAZ0Yw9stZ+nVSri10rGnXoF8g+tD6Mv+F7SxXAcsPsxAGgblZHQNuCbUtOjeMzRID3ci1bXBaFpuzka9hIuNe517uERRI4oW9g13ae/sj9Kb2p02ClwqsIGMvEUXkZfxSIcitIZetusSWZgSDH6aHlxv5/kraqvwHOzRjhnpsFcS7dzCGqyyRmprbaNC+RXU7zhlTaufnmL0z4J2nAjxPsca2pgzcnCijz8rv5b1eUSXNdSjhoV4rbh X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(396003)(346002)(376002)(366004)(451199021)(5660300002)(44832011)(66476007)(66556008)(66946007)(38100700002)(4326008)(41300700001)(8936002)(316002)(8676002)(86362001)(36756003)(2906002)(6666004)(6486002)(83380400001)(107886003)(6506007)(1076003)(186003)(6512007)(2616005)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +ny8ToL4aF75yWMItrY9i1ck3w2kME/sjvtEWx0+Ns+lp1OY84aTTUczauthyhdybUngmWvQ7lSoRNBo51Kt9rvMnikwWslzChD6gYd02RXuTk/rUFZnD7nPKYVeu3l2+MjmqUwtYsN/Gnb3Py5BAOw4CwUnm4sL+NSz1ddU82derSKZy10w43pbjPbi0GttnKBblJwLt1/UBeZHPuThqp61lB15a/o6AQeCeZWr/s1pRmDcwUY5qp7+LPGCu5pg8dXTSz8yqYYFJ88Swz1kQ884ia9Ad85mpJauveOf3uImaZ/6FbgFv1fPNMqnVDqNrYkQAgQek/lqDMt5I67USoEr8sVjCUemHJ+yTwTKigcImvpdJQhVBSxhDJdkAJG8auzeGd25aBwsuvnt20poLiDrEOh64/4lMPEhLHNWePnKk6e27ZdW4/mZZaI0z2o0Sy4cuQp0X9prgdW8aD08P5IHrKcYPsGtm/aLkEGQLj2zLC7LmCd/T0vC7ZYg6efiyFdu4e6GKNa+TzQjOtcoWX9snsDj4n0s1ZalE3ia82fmSvLZvpMkCJB/aerxcWtMyO4fuDGNxuE8M6aUrLP0QbooJqvLX3KqTEyku9uXYKgxIrie2vtAXaDTXK9cz+0cScgYa5fwlL7GM/7obGcqFDx4+Td1c/WqSk66b38GJg2XYvH4FpoImCMOrckz8fvlyVeyn3ey+s+CdsAuE4neIi09FjcqHVG1xj2NdMdWp9CCRlv17BW1Ed+fdF2tzeNyINIC1A5hIpRgFazaJRgBrbxreiVz/umUTINEaLudWdn/BeV3v5XAYpMY02p875AqRAhOeYiLjiVNW9TiWvEfS2wM3CBNlkk8cEWhpBdeRlSJtr4NhMiIZrLZ0UwFokb4Ly9m8E/KhA9W1/YGF8sLjzWelTj/vrOVxtVJREoKzk3jQxSasz/tSZ3kzZM0p1nNd16jrwJEke9kYarED9Gq6Ti8YKtw7sH0MoNYPfzVpaDFQcndzZwVQtMUx42fNpbJGsDc5fnqLuXTL8qNiGAUl+++329GClB5cM4U4w7omHuoBKl56eo+PNVaHHocmHi3tXP/QKHJYcClc50MSmhtNDpFk55GtGaIri0Yj/eT9mQ+KLzuMVz3msb3FILZJNJGfr83roIiYA4DazhP1MjluuhfoqriE86je7FFr/aqyi1xcSlApKTEPj5wKd/NqbBrUD7Tlb5O21tDZT/+DQgHolHrBE/j3fYrZRHtX9X4vgl5bktHHb+wTmsTiGkX457iXToAP8tUny487EGwvhh41E4w9nSo0kZFYiP3nGXNL5kadDVTkS6sw7wgmX3dCVqXYB/k8EK9HBH4oedbJRxgjUaR6ijvAulccopLYqk2lXjrDKJSpCrdXF2SrOjrhl3REk3rOk8hYjpcrYdLL4zDtG5uFsBKw2d5f1P4xqUNGN0I8fadcmzb1yxKZ0CrVMcGtQAfINPgoubIYMg8vM9FpisTdPPh5+krrIOWYanMNxK3EpRXCpqapbmH/txgwgDuSSJI2rgi2pga5xSzs4i2MRoOIKmOf9aExU2qgN1SX5LsIAdZHUJinfC8GrIehgHUmlvHHNA48y4snXSQH29MX1hFnU0oo+DA4xNFhhMAyUk= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: aMJu3aEkZf8PZc78zdF3DWztXX8LtnoV7xyv1Bhop57ZTUQ3/s9xC9Uai8DOyuaZLlM3EEDZ/WcCznbOa3L7Bvt8UKnpVFiCRwFfZBi/H8xvLdRiAIbrgjfouR/PWItNIZhjx3RiEnVPIkLuz+icECaJ8r2Ub2m5jIkc6TkA1bc8yhzTdQGL+FKbr2Bn+ZJ2dh0WMsAraAwUInbwKQSR3rI3pX99aUFE7TKHrRS+gekJhAy126EHx2QoGeX1gXWmYAkNQD9OkBPYjaQUEy+C6gSlTKy+zu2zjQ4u3BmkkO1BO/dHLT8+/uAluUMItX7B/jOunooxzuSgRwG+hM07TR5XI7Ot6eBzaJ+jUMfZbj1xy7j5+YhWLmCz8xlu7Kzb6RMbEn7b6/gUj2pgrXVTA4+8leeoqWpE2K1aly5aeHYkVWX38PCf67xMCwQLb5f76u1nMQIJvKFIth1sqGbxqw7taWDMhzN+HdNyigxBhCMry9V29D77QNcu9oKAs7KbbA6C1tyLHLn8I4WlNK/JFWC5aeJaYHpw5NmUj6VopeNWprJWxA4zyj1e7y/6wOTQE9M+Nwr/gRpIecZbolWCj2B+zeA5PI+dQzw/ppFd9hV4pve3JvRAhQ/8jC+0Ur/SNFOAp+wP5zOT3uoEpkJW2X4+jtecYf+Zmca2jNf69eTkCSleVxctU+5i3Bk1sNbPUqbCCMjulTrtSBHDJGEnXuVWUdoxpMp//SNrMV938U05uzZS9jqaoiRy6hSlFhIMeEcMf+3RiwBrHG15s+SCrgLPAnXui1XjjRXEbmtcX7otsgtT97+LdvTSgTud3HBNOegxF48QvkOxDh/5z9ICcoy4qz19u1DMf4ucGZZpnNvoU1k9Ah/dQKZZb0xf1ZG5MXFXiHgo7hDe16RGAKo86g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cd6d229-86d3-4c9c-120b-08db7e3f7f6d X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2023 16:38:59.0090 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ucPH6ljJbjlCR23BEVnGJG9x6QF0JfFhbfaCeYH9NDCBozPJ7tzIDBgMRZEkr15jJlBsQunNfo8ux4hDrKzYVVX/nQcNeLCyWpW5cfBQsV4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4955 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-06_11,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307060150 X-Proofpoint-GUID: fveeOjDtPfXO6w6BQCfAmz9DZ1e8gBHW X-Proofpoint-ORIG-GUID: fveeOjDtPfXO6w6BQCfAmz9DZ1e8gBHW X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770691066439260118?= X-GMAIL-MSGID: =?utf-8?q?1770691066439260118?= Saves three implicit calls to compound_head(). Signed-off-by: Sidhartha Kumar Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: ZhangPeng --- v2: - move folio initialization after __do_fault() mm/memory.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 673b9fa67d0d7..a59b10e534c07 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4607,21 +4607,24 @@ static vm_fault_t do_shared_fault(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; vm_fault_t ret, tmp; + struct folio *folio; ret = __do_fault(vmf); if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY))) return ret; + folio = page_folio(vmf->page); + /* * Check if the backing address space wants to know that the page is * about to become writable */ if (vma->vm_ops->page_mkwrite) { - unlock_page(vmf->page); + folio_unlock(folio); tmp = do_page_mkwrite(vmf); if (unlikely(!tmp || (tmp & (VM_FAULT_ERROR | VM_FAULT_NOPAGE)))) { - put_page(vmf->page); + folio_put(folio); return tmp; } } @@ -4629,8 +4632,8 @@ static vm_fault_t do_shared_fault(struct vm_fault *vmf) ret |= finish_fault(vmf); if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY))) { - unlock_page(vmf->page); - put_page(vmf->page); + folio_unlock(folio); + folio_put(folio); return ret; } From patchwork Thu Jul 6 16:38:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 116807 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2700209vqx; Thu, 6 Jul 2023 09:59:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlF28MWdlQdfEQ28r6WFcEmhcpvjxxt5Tozth7KVVA0qmbZVM495Ll9qijg3af2eNKAnn4yI X-Received: by 2002:a17:902:bd43:b0:1b8:7c59:7d0a with SMTP id b3-20020a170902bd4300b001b87c597d0amr2456172plx.28.1688662793099; Thu, 06 Jul 2023 09:59:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688662793; cv=pass; d=google.com; s=arc-20160816; b=q9V+It29m5muqd1TFBJ8nUgUPZVZ/NI8zTCGhm8qGshxg5XrHFkMsOMt0ew6/mWVhZ rZLfvhiNdlmGa+peblNeZ5SEa8Yfy6adwifu9QctzHF2Deo3Mbn8+5LdxRqAIX06lGmI NgwK4EFl/v7axCa5cCL+OefObSVieNDcjPaP0mH7qAQbJldW8HRa95p4EEkaEWv7HvNb CHa+jWt7GB0svKHT/BFOBno5yQ95KprcfqR5paUulCmJU1BpDP5WvYxbT5fppUwwOoK2 tJjbJO7d+QsurQiYitBNf9qBv1P6YEqPBv26fid9SmnpH9HH0KuRn5nfiIObdtO3Dxwn N42A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=AlepPsPN5ijLtdW0fpaVmyRQE1pVyexGYLHqAumPIOE=; fh=KAFD5kSwV1XwFKH8ka5uEp2GLJJFdSseJazm66P1S6w=; b=QLbZNg0d4OY2/ddaPohDetxYOkqswc+P1UhBRWfU6zqrc7Hq21C3E8bafEepbEoKhk DhyoywdA/Xj7AScQ/fuIQQzW1xXTUh3mJkp4uh5HzyslGVWEFBPEnhXcPE4loUII9mrm H5RkwSc7HSHlmmsKaWYl51ECAI2lVcZsnPpmCGi7xVSRx0Rlm6Frqx7qCiLVZGgLYUbr FebALUZ6LkMqZ9jc8yXhH9dZ//LgEf6qwnM/C6eGm006R0wqM+Z0TWZD4kwo8hjtWAFt axZMUcoXFTIK6SIL9Yen1J8aVi2mCHCn8D3E4K0pcvkOlYpjJ501t0Ze1CVIQAJ4bRh5 I/7A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=eXxZ5D1l; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Ht+KNam4; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020a170902680800b001b9075dbda2si307993plk.199.2023.07.06.09.59.39; Thu, 06 Jul 2023 09:59:53 -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=@oracle.com header.s=corp-2023-03-30 header.b=eXxZ5D1l; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Ht+KNam4; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231894AbjGFQkK (ORCPT + 99 others); Thu, 6 Jul 2023 12:40:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231675AbjGFQkH (ORCPT ); Thu, 6 Jul 2023 12:40:07 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B929C1BFD for ; Thu, 6 Jul 2023 09:39:46 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 366FwvbX014223; Thu, 6 Jul 2023 16:39:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=AlepPsPN5ijLtdW0fpaVmyRQE1pVyexGYLHqAumPIOE=; b=eXxZ5D1l3WBlP4Dl5ds0s1Ze48perpl/Lnzlv2WefTBihD+qPloukkWK8g9DQ3pO3cgd yHvO2D/Pouxb7BTwrAJu5d/cn7ItGpU2WTmZB6Pl9GWB/lrqM6RRgnEFKvEC1gXJwiYM nG1szY3+bLD0GZh2Y9e/fQh7BX9RM7arfjkn0wdPoj9bdnZYrS+HOA2tDhQ6M54PicvZ VKR2xYp7+RH+mqGpAt24d7E8BZNDkcrjeTE3Ohi42dceyRCPAVCa7ZCKU+7eqD4cJEO5 jQVylJeUvjc5pvXycAeH6kVgienPM9b2F9lz04AHLSFWGn2OKioVUTB/Iyj8n3DurVpq iQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rp0nw03pe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Jul 2023 16:39:31 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 366GXnsM013569; Thu, 6 Jul 2023 16:39:31 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rjak7av8n-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Jul 2023 16:39:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iRiRLsfcgNsP+kOPhJrNfgztBvqokBeqLK3aQpZCBMGlORdMc65gTwK3ESLSKepYcXBIR6d9++Lpwh0vhaU25Vwr8GJkeuDzkhnFhboI4Pj75INFQmVpMmXwqK/tH332ABN9J0A+2C3Q5We9mTD0s/6UArDQjAM+qvjjJ9c6sbL0/UWabRXb/g7nRauBNkaX+LPv5UQaSfl7OE0YYEX8pKwV1oF1mzSN4N9Ha4zijI+uNbX2jFAVWrni9y0IIqCWHVJFN9Q/vr9UGjYBtI6vxWNMQaR5zbCLuZ8573wHzeQyoYpWiruXINIVlDbMvFJZeu9hJF/tgSNTZ+hdK9jgLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AlepPsPN5ijLtdW0fpaVmyRQE1pVyexGYLHqAumPIOE=; b=Jm+UzkcUi09fuiD05EWcJ8PNoDTNG/r73OY1JkZ4hs85hQfiS9kQpts76KyRnq9VeK0K1n2YZkPD8lL01NQQEC2vAE4K96uypDdcOvEmMPWhQUNlW5aXRGDiVvCw4wpFb2beKc96SDH0Z13/7ycpqRROWb7kbR6temAwUvb3bXCyJeV+8XHT8B2b/2W1OoGV/C1R0QM3I2o+5kERW/e4cN9XvzMGonQPvQ61t6nhrbPjBUdYeytapy6FgfME9HmTfjf+YHo4P1fMuA97UhcB8LFeV1Jk/XNe9ZJ1HH4j5Fc7LCmm1t166VA3P0IuF5azR3veIy2Fj8anaGjOUZhjMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AlepPsPN5ijLtdW0fpaVmyRQE1pVyexGYLHqAumPIOE=; b=Ht+KNam4g8GigvDwFocpwmPfh1MqS8IjxFNgMQ1XBrnA7D3dmB5ippeDYi60uqpgqs2tihD7qU5Zy0AcgzLn9x6okhFoF9/WbadTNehc5zoCkNouZmHtxeJmcqc9tY3OvQtHwt1mJiMXC2MMqpCSCY0YSQ9ba47WyY6JZiHNFbA= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH0PR10MB4955.namprd10.prod.outlook.com (2603:10b6:610:c2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.24; Thu, 6 Jul 2023 16:39:02 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::d9c0:689a:147b:ced5]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::d9c0:689a:147b:ced5%5]) with mapi id 15.20.6565.019; Thu, 6 Jul 2023 16:39:01 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, zhangpeng362@huawei.com, Sidhartha Kumar Subject: [PATCH v3 4/4] mm/memory: convert do_read_fault() to use folios Date: Thu, 6 Jul 2023 09:38:47 -0700 Message-ID: <20230706163847.403202-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230706163847.403202-1-sidhartha.kumar@oracle.com> References: <20230706163847.403202-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR08CA0034.namprd08.prod.outlook.com (2603:10b6:a03:100::47) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH0PR10MB4955:EE_ X-MS-Office365-Filtering-Correlation-Id: 16cee2d7-5b92-458a-39ed-08db7e3f810e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fr94jec+W3V9sy51ms8Jn0EydXjfCFtOse7ljYxIuQT/1lsqvHKTJKjfGnubnbqsD9bnvM9XkGUVBdeE4zjm8Lde3gWfvj5t/ASvIqe7Hs0DJKAjE2nlkanvGnDh5Fh+xn69L4fWn43NCUxDpfxEz3i9SghNjnrMUZxQfLdcGhs7wbVkxWJThmAdaWE3AFD5lJkCHQr2TTKn/Gb5CEL5/j25fP/cfRDAJZC/yiil176UB4OIWWvVu5w9++iKE0xwvq0/SGwSOyfaqJWNNUzuyIJInTi+cAvrxQWIFXkpI464jROUTrnqcSiGKmtzcfua9aB350WhUokdNLvUZhPG0B2AQ13LyAt/B1d3V7bPn+1K1/JPjPwnbCGO9sUMhSYSQj9TXn1rmL+SRvrDAuRyFGzSc61W1Yzin1VbEiJmgS5XAO39bH31mB9JCU0x7nmpeX4sL60d04fy5PG8c03JgiD75oyRxcrj4Jo9WguxskTVdswpAG9ODY/kNAntw3CKEmdYwZTLTJHXaXvztBkUNKnkdr+cBfd2eWbBCFh69MYto/pfU5r7620ZKx/VFC8Y X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(396003)(346002)(376002)(366004)(451199021)(5660300002)(44832011)(66476007)(66556008)(66946007)(38100700002)(4326008)(41300700001)(8936002)(316002)(8676002)(86362001)(36756003)(2906002)(6666004)(6486002)(83380400001)(107886003)(6506007)(1076003)(186003)(6512007)(2616005)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tS5tCeXh2zmHlqpRYebjo/+X42pRxi+ozHV1vkaaIv75AdDNtOScfv8SC3yBsp9FJplzDNlwExdsFjCApOU2Fz0xJW64tyDFb1NY5/HZN3Rn6WtkIl1uJcvyB9EsSOLxZRSzViY/3iUTWITv3ZSd/HvaJWHi02qh2I4rteNoMRVH/EnGUbX5atcoY7T9VBVk8nGBkLLxLQaF8zKujRxNCYzWeBN7Ta76AkJtInuhCM1KhwkLGJc3nxOFFGYFOTcM20esLtNCVXIV8+tj4xCN2NQHjtcluNIbqcYKVapgkPfen8A/gNupAddyqZU4LrxN9OMJHCYuOHhZHo8+Ei9IkmQ96Rik0vr65cBnPPBsyjj963RtgkRQNtDfliOQTDz62rhFhbsduavMfxs+dVnRN7mhfNG3vWb4WuyyoQf11ZC3zPn0LyrYOIkKBiz1+qOvObB1r8gcGDVH5QQZwssQMNbDGbE3iPmEAwFszV+xNJm6gPEWVeSjkIN+jpuGZE8Y9Hn3Iqm9Rwi+kAeo7wncBLE4P7nlna5oKuK/UL86awVlRbWbTtAxUX70YkU1RhyUFT/ncGvTeJthUDbhJMahFeTDgaSdbHg5nGxMADjKst0der3RCissffowinWWY91GXEeYa240kgdZTRU6kinfa3yh+3OesBf1A2iEFEm+YbzIxfFWK45QXyb/cNouxpHE4gHChhik6fBzMVvJOWLaW/qFnEXjivTzULLewWEcXoteEUtCkqKqtGsax/SFgo/TPg4UMuMpOMZdNpWEIFvyViSRj0bISi/Fe6BegTuiSPKREEoGShowdS1mnQb1dcPw8haGaYqtuqcIbPls4ioMXMx7sGK6ZaGp8VRAxAZDYctWYhkGq9UlxLqQM3jTDtt97oQLKXowlWs7atnS9JU2TbWRsgQ89sdvpeamZnKBEhkgTNAXt08kAbBtguOB63jqEd2O32rLXll447hcF2dp4J3qwwB/NJUpD7+qXYR1s2hDbp/xwGwYPFAVxLHxDlAKLEx2Y4kljqvpAxC2N/wU8Y0xcnE2SYfctEa7gyRLFbs/yi41pIwBnGeEMUbNwCUtNUBxXZZsd0AKIdsNj4ou++BmLIXcSyokmM4eN0mUnsTQqKrioHosrQGN9osXgR61c/In6HgEAKojuFBlFXidWL8+GazOJR6X2iUA/lBe1wTtKETmgbgAfWQiCTvhumVC3rAF25emjp6NUuDnWNeeYknBVZOmvHG6hrd+24+DJLWPIMNuleTE5N8NgsdHDPSYwE0pyt+5rQK5Uk2MDFYcryAs78ajq+QrLPIAaJASYNlHbwUfYxtrm5eOjs58X3EDmpj9yNlv4Wmx8Z2+u1bS4Ae9/BXA8T6RqJEZb8F/Iv4kyBIkVp8788BIzLxOopWMqC5Ex+6/3NuGYxM6+8dslk7nIRtbnFolN5W7dYZCwwCoFUkHuUrOjcGocSpQjj+rgsu6yl7FFS52wuwmk6SmUB9gPg+ohzWLEAKPvhW/PI2osQec0Y7HQnOXG2nGbxcxTBvv0YYyTedSe5Uhga0A9f1JiI6utLlYOfwGsA+x2o6zOQEdUsted0NCMloQKMktyQ8PBBtdlsTOFclx8UGMTKB1WvYNjmGTkVEA8vk/fU0= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: gpSacCMJq7p7Ik121LRWehy5OIMzpgcvaCRqNLLwHiNXuNFOyhUNHFlBkfKKYjRJ3ovpMTzO61Ug50pCKTPkhUStMJf2caDaAa2T2p95J0ANTTEqQBR3eQTl42K/S177ANaGB0WQpfNpA5lDbvaP0F9vsJeWEYpjLklEynfVxv/ZofybB8lO0DXUK6LDn3e2Uv/yx8SfdcGKKB8IItSana5qKjGmbyTqG3+XictCtl58uYgqSQX8gsAwX2JWfA/nDLOPSJ8OFBqWlByueaK7CJVrREfmZ7J8a5whtzW8c3nGUVw1r71QbuaTDoFD/qhYsnRiLPOHBTCQEH49vDCsjbJ5RKoBm4ysACA0J6atfQISG0WvbZI1ifO03hZ5+SNrr/DbjLEAJJn799CmW5NnNONvULnnmL2oOqwldW4lafddI95NrJWk36A8MEJU7xA2dyNnYm9OwZp0pmzuGKQfhiwC+PhWPSe4Y/U4L9kHJTfQIlgLYFGJ1hfgaPNDKKqj0kotlc+zPmjKT9mW9ULCo8X8tpU94GNlukDtG8MpwaRnNnlwR+HlLNrJaI1jIKFrZadjjdfI25r8MTO0c/wl4YSFu7EPCCxPgL94jcgFS9h7O2PeTTuU//Nd18MqV4HGcDJjO/nAo1oJ4xhjivgQE4GN03KQD37f59Q71NBJ/AK4Ozz0xIpVpJckITh7Bb2PmpPTYrhI+noJgNPjDaR7xRquXf9RToDQys3UO2myRWbdEZDHdTlAZrtP4FkXjmPWTogvzGURiN/PwxjhwlQwISxkItSrroNXd2aNuPziF1MMhoo3SocU1ygFPI7eH6ZURgKmmdPqDL7yka0icEfd+6DdFJqEX4O/KOEB7NBtDhYYfCzfYEE29HitPHl3sGIljwjwEtopnPf+jzwKeAyIuA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16cee2d7-5b92-458a-39ed-08db7e3f810e X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2023 16:39:01.7615 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Uia3hf0jRoy6uv2pNR5UgpJl6oB3T0GgaUtJ1cqZR1SxifrgttnVMzStNGxM1xHFcPsX1pOhEhztDspNJtz7gZznvFGbFZmy7xYBdtIEaZU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4955 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-06_11,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307060150 X-Proofpoint-ORIG-GUID: v7EttGctZifglOwKhdnpVggBVL0lpqLG X-Proofpoint-GUID: v7EttGctZifglOwKhdnpVggBVL0lpqLG X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770691276833008567?= X-GMAIL-MSGID: =?utf-8?q?1770691276833008567?= Saves one implicit call to compound_head() Signed-off-by: Sidhartha Kumar Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: ZhangPeng --- v3: - move folio initialization after finish_fault() v2 - move folio initialization after __do_fault() mm/memory.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index a59b10e534c07..64e1eb840dec7 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4541,6 +4541,7 @@ static inline bool should_fault_around(struct vm_fault *vmf) static vm_fault_t do_read_fault(struct vm_fault *vmf) { vm_fault_t ret = 0; + struct folio *folio; /* * Let's call ->map_pages() first and use ->fault() as fallback @@ -4558,9 +4559,10 @@ static vm_fault_t do_read_fault(struct vm_fault *vmf) return ret; ret |= finish_fault(vmf); - unlock_page(vmf->page); + folio = page_folio(vmf->page); + folio_unlock(folio); if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY))) - put_page(vmf->page); + folio_put(folio); return ret; }