Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp25911178rwd; Mon, 3 Jul 2023 02:48:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Phi0oHHwiI7RQikvXGme+taUTFQ94IfXEvpmEjtDTPrROIRy8HM4hrlq6O/gEsIQ+zIV1 X-Received: by 2002:ac8:7dcc:0:b0:3f1:f14f:9fd2 with SMTP id c12-20020ac87dcc000000b003f1f14f9fd2mr12110582qte.48.1688377690106; Mon, 03 Jul 2023 02:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688377690; cv=none; d=google.com; s=arc-20160816; b=U2Eob2mdhbuxFn+YqvXnlelsr7Hui12bNrwwBOs4WD5rAJ3xGA4cwSe6BnRw9PaY7U CCSK04e9muHjvXjdx27tCEpU2y/Iw1rMsJQIc6W7hKG9udFi4LtbqA3STkr4t+bX9FkC hyfNothmi1GOsTZEjoKcGK7Sd8kaiw18uuQP3M05ayKDLyk4SHflTi9zAnhRqjxpbcjA k67vABYoDxpGKvO5utPbO8d5aAQO7n0hG+sRd3xoW3MFdFKwjfni1TddKGwLkKCoNnWX DdHgu9qUBEZw3hBTL+KhM6vBmRNvAlsu4CavS8SwNP+rfBIeOxAyEN6/gTOoTHjEzZAV T3Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=n50xwwUeaWsnoh9b7DbBP8QWgnxsOPv8kdiqn9FY/t8=; fh=h+9HgR3AAwG+e4Yt7evsL7285BUAf85XQXsky7Z7DG4=; b=KAm/DRPxVYVBp6Gb21Ok0qArepfkQ3Gcn8tolWjthMcGk78qTnQQCR2q7OZZBr9F34 szoxtEzognRS2jd7W1CZ8YfJsG1A2DAF9CdXbjTU95/p1Lvc8It3d2JR3axkdNwXjNpW KL5ls91bheJ6Atch8eWvHQZ40tOj0zbLJO+3SRGZASpe5HfRtidhkeKdEM+hbGpWDeb8 y8j7K4KWxgUu9ZHyLeRTD3K/Zbny+PjCVUPAQFObXgidJ2MU5Q9GfUkw3/ub1LcoNII/ 9KuMMzrkQe8lWFi72kzr0UMrmvK2Q+shY+HZ5I6U+A4Bg97gO4ttnusA7jEsa6YKncBm bjYA== ARC-Authentication-Results: i=1; mx.google.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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020a634a03000000b0054a291a0bf9si17549919pga.672.2023.07.03.02.47.56; Mon, 03 Jul 2023 02:48:10 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230156AbjGCJ3u (ORCPT + 99 others); Mon, 3 Jul 2023 05:29:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbjGCJ3t (ORCPT ); Mon, 3 Jul 2023 05:29:49 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE75D196 for ; Mon, 3 Jul 2023 02:29:47 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Qvgc16Hsnz1HCqn; Mon, 3 Jul 2023 17:29:21 +0800 (CST) Received: from [10.174.179.160] (10.174.179.160) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 3 Jul 2023 17:29:44 +0800 Message-ID: Date: Mon, 3 Jul 2023 17:29:43 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH 3/4] mm/memory: convert do_shared_fault() to folios Content-Language: en-US To: Sidhartha Kumar , , CC: , References: <20230703055850.227169-1-sidhartha.kumar@oracle.com> <20230703055850.227169-3-sidhartha.kumar@oracle.com> From: "zhangpeng (AS)" In-Reply-To: <20230703055850.227169-3-sidhartha.kumar@oracle.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.160] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,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 On 2023/7/3 13:58, Sidhartha Kumar wrote: > Saves three implicit calls to compound_head(). > > Signed-off-by: Sidhartha Kumar Reviewed-by: ZhangPeng > --- > mm/memory.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/mm/memory.c b/mm/memory.c > index 93480e846ace6..33bf13431974c 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -4594,6 +4594,7 @@ 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 = page_folio(vmf->page); > > ret = __do_fault(vmf); > if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY))) > @@ -4604,11 +4605,11 @@ static vm_fault_t do_shared_fault(struct vm_fault *vmf) > * 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; > } > } > @@ -4616,8 +4617,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; > } >