From patchwork Wed Mar 16 07:59:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12782430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B65C6C433F5 for ; Wed, 16 Mar 2022 08:00:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD26B8D0002; Wed, 16 Mar 2022 04:00:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D82AA8D0001; Wed, 16 Mar 2022 04:00:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C70BA8D0002; Wed, 16 Mar 2022 04:00:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id B9EEA8D0001 for ; Wed, 16 Mar 2022 04:00:41 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 67389214A2 for ; Wed, 16 Mar 2022 08:00:41 +0000 (UTC) X-FDA: 79249502682.14.D4DCEB2 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf04.hostedemail.com (Postfix) with ESMTP id E6F774002C for ; Wed, 16 Mar 2022 08:00:39 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KJN2h4CnHzfZ1t; Wed, 16 Mar 2022 15:59:08 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 16 Mar 2022 16:00:36 +0800 From: Miaohe Lin To: CC: , , Subject: [PATCH] mm/swap: simplify the code of find_get_incore_page() Date: Wed, 16 Mar 2022 15:59:41 +0800 Message-ID: <20220316075941.44816-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: E6F774002C X-Stat-Signature: dx5cztriyo53uya6xmgh9qk997ondxns X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam02 X-HE-Tag: 1647417639-594464 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: pagecache_get_page() can return subpage for us if we do not specify FGP_HEAD. No functional change intended. Signed-off-by: Miaohe Lin --- mm/swap_state.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mm/swap_state.c b/mm/swap_state.c index ee67164531c0..517b4b856e32 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -394,13 +394,10 @@ struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index) { swp_entry_t swp; struct swap_info_struct *si; - struct page *page = pagecache_get_page(mapping, index, - FGP_ENTRY | FGP_HEAD, 0); + struct page *page = pagecache_get_page(mapping, index, FGP_ENTRY, 0); - if (!page) + if (!page || !xa_is_value(page)) return page; - if (!xa_is_value(page)) - return find_subpage(page, index); if (!shmem_mapping(mapping)) return NULL;