From patchwork Thu Nov 12 21:26:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11901683 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 001C41391 for ; Thu, 12 Nov 2020 21:27:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8EEFA22252 for ; Thu, 12 Nov 2020 21:27:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="a9Dldi9i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EEFA22252 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C10DF6B007D; Thu, 12 Nov 2020 16:26:58 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B9B436B007E; Thu, 12 Nov 2020 16:26:58 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A679E6B0080; Thu, 12 Nov 2020 16:26:58 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id 65C336B007D for ; Thu, 12 Nov 2020 16:26:58 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 17229180AD804 for ; Thu, 12 Nov 2020 21:26:58 +0000 (UTC) X-FDA: 77477051316.07.heat73_4a0062427309 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id F129E1803F9A1 for ; Thu, 12 Nov 2020 21:26:57 +0000 (UTC) X-Spam-Summary: 1,0,0,5b9d079becc359d9,d41d8cd98f00b204,willy@infradead.org,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1539:1711:1714:1730:1747:1777:1792:2282:2393:2559:2562:3138:3139:3140:3141:3142:3350:3865:3867:3868:3872:4321:5007:6261:6653:10004:11026:11658:11914:12043:12114:12297:12438:12555:12895:12986:13069:13161:13229:13311:13357:13894:14181:14384:14394:14721:21080:21324:21451:21627:21990:30054,0,RBL:90.155.50.34:@infradead.org:.lbl8.mailshell.net-64.201.201.201 62.8.15.100;04yf5eysxej95nu59ktaqzotkmbz7ocqoqi6abkencoxwrheooybxssguaz3xtp.xbncjo3nj4i3gyootdy4me4ntcxfjt7xryr1ca6ebg767zyypjqxadsckpynpze.6-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:68,LUA_SUMMARY:none X-HE-Tag: heat73_4a0062427309 X-Filterd-Recvd-Size: 2454 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Nov 2020 21:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=w06ZP8J1L1sNnrL6d7bu/K2RwiChw8umB6NkZXCjOJM=; b=a9Dldi9iEA7FsD03s2jU9jo1jw DCu12xlb5XFWmxWtgbqZO4LCcIUcnPn2cAeWN/YBHpH4yuWcCl3xgOxosVLAev/3+F+Oj2gZBcC2J +yWjYaqWuopWkvwOP7IPzWAznGyc1hWUmCXD1cIyIQ0plBCNNy3Mk1Rcj6F9GF0yQH+wiNOZTaFKE N2oR/gMEzTOCXt80wJZ1HPQyWkHSO1BrpcvUXkSGwHSQvsSUwXulC72JphaN3rocSWx3TGiT8UZlm 3gIQITyu4v+ifFvLr06G9cgYZ6Nrui1twyBnSOEFKIFiBHLqiELYE06q6lzb3KIJVPzCybJYqrWo3 Wv0E/QQA==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdK7A-0007GF-Qj; Thu, 12 Nov 2020 21:26:44 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , akpm@linux-foundation.org, hughd@google.com, hch@lst.de, hannes@cmpxchg.org, yang.shi@linux.alibaba.com, dchinner@redhat.com, linux-kernel@vger.kernel.org Subject: [PATCH v4 03/16] mm/swap: Optimise get_shadow_from_swap_cache Date: Thu, 12 Nov 2020 21:26:28 +0000 Message-Id: <20201112212641.27837-4-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201112212641.27837-1-willy@infradead.org> References: <20201112212641.27837-1-willy@infradead.org> MIME-Version: 1.0 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: There's no need to get a reference to the page, just load the entry and see if it's a shadow entry. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/swap_state.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/swap_state.c b/mm/swap_state.c index cf7b322a9abc..d2161154d873 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -113,11 +113,9 @@ void *get_shadow_from_swap_cache(swp_entry_t entry) pgoff_t idx = swp_offset(entry); struct page *page; - page = find_get_entry(address_space, idx); + page = xa_load(&address_space->i_pages, idx); if (xa_is_value(page)) return page; - if (page) - put_page(page); return NULL; }