From patchwork Fri Aug 26 09:24:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12955713 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 C1F29ECAAD2 for ; Fri, 26 Aug 2022 09:25:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E60C36B0081; Fri, 26 Aug 2022 05:24:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BAE13940007; Fri, 26 Aug 2022 05:24:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D7336B0083; Fri, 26 Aug 2022 05:24:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8AD006B0082 for ; Fri, 26 Aug 2022 05:24:58 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6EA8080240 for ; Fri, 26 Aug 2022 09:24:58 +0000 (UTC) X-FDA: 79841209476.28.286C54E Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf10.hostedemail.com (Postfix) with ESMTP id D8A9BC0003 for ; Fri, 26 Aug 2022 09:24:57 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MDZBS4mjmzGps0; Fri, 26 Aug 2022 17:23:12 +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; Fri, 26 Aug 2022 17:24:54 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH 07/10] hugetlb: kill hugetlbfs_pagecache_page() Date: Fri, 26 Aug 2022 17:24:19 +0800 Message-ID: <20220826092422.39591-8-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220826092422.39591-1-linmiaohe@huawei.com> References: <20220826092422.39591-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661505898; a=rsa-sha256; cv=none; b=5vKXrpCJOHctSj6eQ8Lmp0YyKvYkT6DpZsgpELf/KbkJYO00a1YiUaErUw9RHyGvAdmS8U BzJ5lPkqjLuy7asxErYFXv2aDF4DZ55fVUk50HpZb2sE5UiyVBaPY5zkJScmvt4GxfxRRZ 2ZwsZftzSfq5F3CmYRPwxYuGpw6bjck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661505898; 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=+Xk64KVAAaYQPUxAuR1Wybyf4dlQ4Z+TVC25hHLkgkk=; b=Rb/UDQDv0HQ56Nr2dkPj1O8Xn4yP5g1sOZYsQrgqUcPBaHsNnlYLG2BUSEdkhsVofts99U gc3XMwoKwZr8o2Ze/U8BImOqDOJxI1Whh5gIsbnFqbK6Yeb91w3adxCCet80DZ7sLRYhnq AVuplJcTa/Qa0OXXagaFBj3kknaOyW4= Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Stat-Signature: r1argnd4zc3m6ghs4j8iye3zb4eanuii X-Rspamd-Queue-Id: D8A9BC0003 X-Rspamd-Server: rspam04 X-HE-Tag: 1661505897-988701 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 58eeae934e09..7934188bbed0 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);