From patchwork Thu Sep 1 12:00:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12962360 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 64557C0502C for ; Thu, 1 Sep 2022 12:01:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F1798D000A; Thu, 1 Sep 2022 08:01:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A0738D000B; Thu, 1 Sep 2022 08:01:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 556858D000A; Thu, 1 Sep 2022 08:01:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3F56E8D0003 for ; Thu, 1 Sep 2022 08:01:11 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id EA6F8C0F73 for ; Thu, 1 Sep 2022 12:01:10 +0000 (UTC) X-FDA: 79863375900.26.A4140CB Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf07.hostedemail.com (Postfix) with ESMTP id 7AA3140057 for ; Thu, 1 Sep 2022 12:01:07 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJKKt3TQ9zlWdm; Thu, 1 Sep 2022 19:57:38 +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.2375.24; Thu, 1 Sep 2022 20:01:04 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH v2 07/10] hugetlb: kill hugetlbfs_pagecache_page() Date: Thu, 1 Sep 2022 20:00:27 +0800 Message-ID: <20220901120030.63318-8-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220901120030.63318-1-linmiaohe@huawei.com> References: <20220901120030.63318-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662033667; a=rsa-sha256; cv=none; b=aWJO2BE42533fKn1MOjQ68cfNggB+po2G9jTYLdJ0DTa2QGNupvwj1wsel42QTOASFnaF+ ElxhukUXQThtJhhvU+KKpA22htqkss/hx74jk84Apcy/XMiAV5YCSDwj0YasY2qHDYWITa QWrhoL+WjKNGIarthauJufX1hUXhLzQ= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662033667; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Htnv6Hzzg0SvtUVeGO5PQPXzObqnReFRT1XowUTteJk=; b=7Vz39lfMcYB8PFRf5rEWhbxjfi/fiUZ1llQOLgolW8/OjrYjYBzGqg5vonILIdvgxxaiZl RPcdMsbxtF55WduS9YIGXT3/f4+F9wAxdDvGgfDo3pjF5t59OttXufps2NePsDITy3vLGJ +QYXaXrp9hHxqGu6HmTBtD1wiCfT++8= X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 7AA3140057 X-Stat-Signature: sbmoha1rotzyps8kgabfdwfo4qk6ewx8 Authentication-Results: imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-HE-Tag: 1662033667-821304 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: Fold hugetlbfs_pagecache_page() into its sole caller to remove some duplicated code. No functional change intended. Signed-off-by: Miaohe Lin Reviewed-by: Muchun Song --- mm/hugetlb.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index bb65b7fdca25..26bcc85715eb 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5467,19 +5467,6 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, return ret; } -/* Return the pagecache page at a given address within a VMA */ -static struct page *hugetlbfs_pagecache_page(struct hstate *h, - struct vm_area_struct *vma, unsigned long address) -{ - struct address_space *mapping; - pgoff_t idx; - - mapping = vma->vm_file->f_mapping; - idx = vma_hugecache_offset(h, vma, address); - - return find_lock_page(mapping, idx); -} - /* * Return whether there is a pagecache page to back given address within VMA. * Caller follow_hugetlb_page() holds page_table_lock so we cannot lock_page. @@ -5885,7 +5872,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, /* Just decrements count, does not deallocate */ vma_end_reservation(h, vma, haddr); - pagecache_page = hugetlbfs_pagecache_page(h, vma, haddr); + pagecache_page = find_lock_page(mapping, idx); } ptl = huge_pte_lock(h, mm, ptep);