Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29579116rwd; Wed, 5 Jul 2023 14:10:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlG9owmCH15/HW1YCcLXG6UD2z2yB0RKT4SmyFA8qTu2ueZqDqYGsZO1oTc6QI4OUNm2guZ+ X-Received: by 2002:a17:90a:a8f:b0:260:fe48:491f with SMTP id 15-20020a17090a0a8f00b00260fe48491fmr13634167pjw.45.1688591423018; Wed, 05 Jul 2023 14:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688591423; cv=none; d=google.com; s=arc-20160816; b=Kubopheu5BxVIrnZwYT2HTRfjZn22rUB4oQ49yqBZ+7b9u6Rq5CcBfLs5PMb94D8Or fzXjh3ONuqJWLIRjyB4ro/wOfAoUNdtcoGBknwqeP+0ohPu2FP4VlDHTVHazYA9MV7e8 +vgKmyVylB5bZgMDxp+RFK3MOeM06JAbqvJ/189v18lNCMMAg9lXCy9IDYbCUov0pIRc 4OHIAnehr8dSsXAcyi26FBQqIA/aV5zJo649Tu67uThpwBex60gyTKik5INr45UfhkJu 8eqtNLo+d5K/LEveT2FC62bEk8vbeslwLrmz/3jjyDdEvWKF5mMBOFM/oKe39SE9p8sN nxeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=T0XLnvzn5FkOLIw7q3RfBWKmkfDnS0W7AG/lbyZT7fw=; fh=rFBXwciewBJ5o1wYI8iFu+fFsqSMrTS1etjlp0ekYio=; b=GL+qUGgsS3LaUD7/ZE8mVkzTA44vySfDeucKk217Tdfvdc438Pxa66u+4i8rXNNlSY egLXZicueQEEnWFuhZU54oiGL1HO78F+7g94iGE+plnZAnG5D9zg0ymSN3ng09K1/lVL J8/yPocZLc1ae6Xb6c+RJypTDF3p9VcWnFpeXlPBW482SkVnjS6zOGEf+FvhY5dYhuYI Lkd+l5VuxbLB2SrZ11XenX+UQdstOA/cZn0Oa99/0kFWJthRscPMgCcxfx4VwXxJ1LL6 MZkHlE9k3L0e67r1PM+5JihuWGgtOKF9QQRHrITJPVl68pNJGUNiIpQuhfBtgMEizFIf Yx6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="Q8nN/eVz"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb14-20020a17090b4a4e00b002610f13639asi2695730pjb.91.2023.07.05.14.10.06; Wed, 05 Jul 2023 14:10:22 -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=@infradead.org header.s=casper.20170209 header.b="Q8nN/eVz"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233430AbjGEUTG (ORCPT + 99 others); Wed, 5 Jul 2023 16:19:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232401AbjGEUTF (ORCPT ); Wed, 5 Jul 2023 16:19:05 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6AC41985 for ; Wed, 5 Jul 2023 13:19:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=T0XLnvzn5FkOLIw7q3RfBWKmkfDnS0W7AG/lbyZT7fw=; b=Q8nN/eVzqtRFhuNEk4/aZxiwlf b7nmE8lceUwvvkelHvAh5oK6q5zyM86Kco60daX9344Go8jHWsQhYFgnDwjMdBblwWw5YWU5nZ+Lp zBH+5PCKSX65joIEYLlpbOw4UK471N0qDkcUmLnMhR/OyZ5qxj57WWKNkEvf41yxTvfoQrrhM0yc9 5F8C+pmqA0h3nHWwswjhLTC29fyoiuUiOBxiewi/YDVrcCSMIBjUFzgtj247FDte95jEFQZAQQVt4 oJfH7aftPSAW8CxkGBtSn83CXOLoYpoyoi7WrMECd0vaqo8diyrlZb0LoqVd0aMMf21rHGzI+J/V0 b1LwHeTw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qH8xp-00AORJ-Aq; Wed, 05 Jul 2023 20:19:01 +0000 Date: Wed, 5 Jul 2023 21:19:01 +0100 From: Matthew Wilcox To: Sidhartha Kumar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org Subject: Re: [PATCH v2 4/4] mm/memory: convert do_read_fault() to use folios Message-ID: References: <20230705194335.273790-1-sidhartha.kumar@oracle.com> <20230705194335.273790-4-sidhartha.kumar@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230705194335.273790-4-sidhartha.kumar@oracle.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Wed, Jul 05, 2023 at 12:43:35PM -0700, Sidhartha Kumar wrote: > Saves one implicit call to compound_head() > > Signed-off-by: Sidhartha Kumar Reviewed-by: Matthew Wilcox (Oracle) > @@ -4543,10 +4544,12 @@ static vm_fault_t do_read_fault(struct vm_fault *vmf) > if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY))) > return ret; > > + folio = page_folio(vmf->page); Why not move this down to after the call to finish_fault()? The compiler should be able to do a better job with that; it may have to spill it to the stack to preserve it over the function call. > 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;