Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp678106pxb; Thu, 12 Nov 2020 13:32:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOt7Y52ouoJ6BEkdE10AWw0/lD0NmqRMGu2fNil+EQLhSeZ4XlqpX4o9fZ3cQMzX1h5+ZX X-Received: by 2002:a05:6402:88d:: with SMTP id e13mr2091386edy.366.1605216724481; Thu, 12 Nov 2020 13:32:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605216724; cv=none; d=google.com; s=arc-20160816; b=zTxy2YBLYbhaBMJPPpa/Mn5gCdovCxrMu0S6fkwEETjGj5ahiBbm4qlP7nlNmyR0QV 3W9nA/9GROvR4ziLzswTmn+oNxBRGLKU9ajPLVHlT5GvT41rwoJJDXZEpioxNNsDtvQ6 P+l6c1I+3kJmcQP5xqe4J0VVgIjQS61J79CgYLJ72hzO/m3jeS7soo+HypnCLwmWpI/j BII5kGtYyUkCLUa/NYY0y1vGOlI/Nfz8DbPXgk4wBMZC60XjGQhjcXJFTj7qDwFo46rJ 8taaad1GObct7LkjWiNGrX1NVxhg7Sfjfa7OlkVtdfViSVe6islAORZWF+56LoDl16zb 22xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=w06ZP8J1L1sNnrL6d7bu/K2RwiChw8umB6NkZXCjOJM=; b=hmH6Gnq1eJqPuHoM/0/odDEmTKecrWfe8PTFUVlLOQEdBxb7FtJ6VAJxXaNJhmxqPG BQN9GE3/dULIqFmJvv22LdJmUBGq3qroatxFCNT4HbDuTATSfd30osmJdrA7PCbS0z9l Bd+TRy8fz0O6QbheaO7FjjzU2QZkPUqbwDNvjwr368bwIZPzP/W/ZvXO46T4revz8+8O SkQQLWEMCxSRj99KUr641nDayH3yIxjdjBsvX7RfC9n+pTOt5hQCOBDqWzeWpymWhklj CBBcS7S7Of49RVDporD5SXF1g+u47VM9ABw+R91opqLAHkxSzBaLL2yCwBMGPyZNe2+j uM5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=a9Dldi9i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq42si4673030ejc.719.2020.11.12.13.31.40; Thu, 12 Nov 2020 13:32:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=a9Dldi9i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727626AbgKLV1h (ORCPT + 99 others); Thu, 12 Nov 2020 16:27:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727482AbgKLV05 (ORCPT ); Thu, 12 Nov 2020 16:26:57 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0B14C0613D1; Thu, 12 Nov 2020 13:26:57 -0800 (PST) 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) --- 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; } -- 2.28.0