Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp25909442rwd; Mon, 3 Jul 2023 02:46:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlFTLIS2b263dZtEGWD0vmFAtp5jrk3hatl9cje/BucUqxvjXqhnS5KOYk2mzwiDgqwLvKOn X-Received: by 2002:a17:902:ecd2:b0:1b5:5fd2:4d6e with SMTP id a18-20020a170902ecd200b001b55fd24d6emr12073184plh.58.1688377581364; Mon, 03 Jul 2023 02:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688377581; cv=none; d=google.com; s=arc-20160816; b=P+iZw6HAwAgZSBpYWUXfnWf6PAwHSntkUBHvRPpXqB93DyqeHtcXN5bmV86bP1O1Ev Af/fcZW/aH/Jtm1TKG6UDtMx30q5CoNJ6lzD+p+Hgy0+SYfJ19PJe6cM7dUU7g8YLVBo VtW8Qn2t/JJ/95KfRzMMwDQXFqYP3Co64d5Us5ikniFfEU136dcQOn5RlTKnbpazf+D8 UNK3r9lE0cmHl0TnqvNLM+BjK+pBQ/smmkpK+9enUKi0ev+s06HAyoSVcks8Rf3MRtKc M9KNR44ZrEjdRNSits+Mt+Wdbptd7JXkq5+g0e6YSJIk5cyC3aj7geEW7pnFnnquFRYD OYyw== 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=nEb7Tb96BWsp3vsxjLlITVu1RvjhPq480vCKg906bOg=; fh=h+9HgR3AAwG+e4Yt7evsL7285BUAf85XQXsky7Z7DG4=; b=iTzJ16/wcD+Iw4c+HBKZFowC7/zjnp1v6Js+ABjXqbB54oXqQz/Yqpq6OqKakN++do YPUspGlH+QHVpV86zMtzT4bpdCDAikJOh2NEpokMmJqvZ3js6WOMSkw3wvD1c64kOb68 D9Mi+tnIzHq1bvEZ/YeJ51Cyr3YlJP29xqL7i3epAdzYyYhuu4qi+MgRVOf/jIBI5I3w nSV9tGfZ4FNrnQDL0h9a/Vjfa47xwpPCuZwKthljNZALDQg/Xu6q3+/he2m055mALdLh 2RkBujFfzy0A1Tzz37vBmorIsMpw/XsjvFFsPUupTr5tgkTUn2NlnO+7vXD+ql0J/zJb TMxg== 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 kg14-20020a170903060e00b001b89bfd0c34si1026913plb.18.2023.07.03.02.46.09; Mon, 03 Jul 2023 02:46:21 -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 S230110AbjGCJaC (ORCPT + 99 others); Mon, 3 Jul 2023 05:30:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbjGCJ37 (ORCPT ); Mon, 3 Jul 2023 05:29:59 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CBD1E59 for ; Mon, 3 Jul 2023 02:29:57 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QvgbW6H8kzTm8F; Mon, 3 Jul 2023 17:28:55 +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:54 +0800 Message-ID: <4128bc10-5110-983c-192f-afe8b856b329@huawei.com> Date: Mon, 3 Jul 2023 17:29:54 +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 4/4] mm/memory: convert do_read_fault() to use folios Content-Language: en-US To: Sidhartha Kumar , , CC: , References: <20230703055850.227169-1-sidhartha.kumar@oracle.com> <20230703055850.227169-4-sidhartha.kumar@oracle.com> From: "zhangpeng (AS)" In-Reply-To: <20230703055850.227169-4-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: dggems703-chm.china.huawei.com (10.3.19.180) 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,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 one implicit call to compound_head() > > Signed-off-by: Sidhartha Kumar Reviewed-by: ZhangPeng > --- > mm/memory.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/mm/memory.c b/mm/memory.c > index 33bf13431974c..b97c66df4adac 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -4528,6 +4528,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 = page_folio(vmf->page); > > /* > * Let's call ->map_pages() first and use ->fault() as fallback > @@ -4545,9 +4546,9 @@ static vm_fault_t do_read_fault(struct vm_fault *vmf) > return ret; > > ret |= finish_fault(vmf); > - unlock_page(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; > } >