From patchwork Tue Feb 20 03:48:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mawupeng X-Patchwork-Id: 13563362 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 13322C48BC3 for ; Tue, 20 Feb 2024 03:48:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2ABF26B0087; Mon, 19 Feb 2024 22:48:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E66F6B0088; Mon, 19 Feb 2024 22:48:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 088F28D0003; Mon, 19 Feb 2024 22:48:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E709A6B0087 for ; Mon, 19 Feb 2024 22:48:48 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 63C0112058F for ; Tue, 20 Feb 2024 03:48:48 +0000 (UTC) X-FDA: 81810800736.16.D431942 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf25.hostedemail.com (Postfix) with ESMTP id 56BBBA0003 for ; Tue, 20 Feb 2024 03:48:43 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of mawupeng1@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=mawupeng1@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708400925; 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=1y5FaYj1i+odH+owYs3noPuKxt5kmgxCeslWrccCwcI=; b=gITR8liGE4LK2KLwptkn+TrGY9exYhM7QCsQ2RnuiIM8ntBdZqLTOl3FSbrLj/QJkjbrUw DZPrRat3W2xSuGn/DzlprNkL6m1Rh6/Lk31HIx56gxpBWyOB6RFt+kLpZjsimkaqDbjBVy Wt6pBjHjFYu6y40QnUWhyud55BzYazc= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of mawupeng1@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=mawupeng1@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708400925; a=rsa-sha256; cv=none; b=KjQgtRqHWyr+x9Fd1gen1KoMVscipKfVMaOWsA7T9ULaolgNe26QsiO9acdzFxxi3WQPkz IrPsSGxZbiSgZ7lQdqoYGxiRMLx1PbbRQWsOR/zMg5iqTgegQ9HPA3EyiCYfffccHmQeqB kOljpgIX66RlifvGeR5FB0MaWl6AKmM= Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Tf51P26KHz2BdDP; Tue, 20 Feb 2024 11:46:33 +0800 (CST) Received: from dggpemd200001.china.huawei.com (unknown [7.185.36.224]) by mail.maildlp.com (Postfix) with ESMTPS id 09ADB1402DE; Tue, 20 Feb 2024 11:48:41 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemd200001.china.huawei.com (7.185.36.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.28; Tue, 20 Feb 2024 11:48:40 +0800 From: Wupeng Ma To: , , , , , CC: , , , , , , , Subject: [PATCH v4 2/3] x86/mm/pat: Cleanup unused parameter in follow_phys Date: Tue, 20 Feb 2024 11:48:34 +0800 Message-ID: <20240220034835.507022-3-mawupeng1@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240220034835.507022-1-mawupeng1@huawei.com> References: <20240220034835.507022-1-mawupeng1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemd200001.china.huawei.com (7.185.36.224) X-Rspamd-Queue-Id: 56BBBA0003 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: ihfgro49d1wtwx9ith3fsanpztyo9t5x X-HE-Tag: 1708400923-560609 X-HE-Meta: U2FsdGVkX190vQ+rGI4G30G0mpVCajzGMQwaV9TgGNI4ZMcg7dSzEEJDJjMFD7xJkz4aPpnIhQnUe5+Y1gznoxIEzc7xH8ykaeV5d5LDB5HFV4q1bUmOA2PkVMbuoeggDMckLBxQK9UHLVmjvZhMAMNUD3FspWJPGkVx0wij3+EQlga0afaI3qCNkUpRDwrIO/tXKT+u5d8khA7b53tV04LHgo16TLCF+lFBCON+CleW0CbH1OKiyzIL9yt89QRyrEciBOgMjwDk+HKLNBxxEnJSme8xiLfkyVM0T98+pq8aIwMfGHvQ4z7iC4b/Ap4SJwGbSJlV3OIxwtiYg2PEnoKMTjMW+/eqzI5zMT5RynDF9PdOI3tUXax6AZ01iQ7NGxLGL537zUmyLuKahbAv4jNTWsWV47QR6ZRlQLoIXlbDoS26j7zk7A0M1cpINfsSjuFzWXV4PKPF1L4hdDZxjvbhMiCplkJ26Yaq8M68dsN5woYmdoO+KNBnRZgsKS0h5pOXlUZOgpaVAkozDFEnTH4xsESpTHSVTum82h1O3EwIqcn3ay+MKWvo9XT2O1QH7qZOah3L+fz9Yy/qAoeuPVNG2SyAJbk1mYOMvIyHIC6w4Z+ihTt+X0MGWndrX51CjXi6ckFBashHg4bCI6yEFIQ8W4Vfw4O774QVcRrDFgILWuZHeqZvmmiT+hY5I3r9CYaB8TIINw5DQahWS/LN8cJstPQfUUiImMRt7+g/AkugxYpi1ftCXUhLTkoPvJCiXOOGbcC8/9D45YVL8mamJqQAgEvIHhRV+FPxo197UllsGeLHu17KF9QsneC+5/RaoPKQAocLYJdOJR38UVNBDwVcyCJ0Bu4uF8oCDpQK3CN4pg73KuhQXDIN74u2HQ+QaxXBOcEyR2XFb4UjGdp3HaTBWvpR+0Lvcp25gXlSxqgTB/U8zQYuy6Kkx8qE6oA0xKF9qzOQGuXuUXC8kld +RxRVXDK nVovNc9MZtDaRyRljVePF3gQ7UMVSeuODPJ0v0lEw0RPSFrKcrfNY9u5H3jCBAyERF5gVOouEytkLOggF4RkM+NuZKMM07+BNSnqyDmA52eC1t+H+1vZamUg5A653XUKrcDNiHrd5RQIlRnARdKXh1DZw5NEsG7KisH83S2SX9qoJRZHkoVDRpqnNrwohCEC2kXtg 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: List-Subscribe: List-Unsubscribe: From: Ma Wupeng Parameter flags is always zero in caller untrack_pfn() and track_pfn_copy(). let's drop it. Signed-off-by: Ma Wupeng --- arch/x86/mm/pat/memtype.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c index d8c37aaaf041..5b56f08f8ce6 100644 --- a/arch/x86/mm/pat/memtype.c +++ b/arch/x86/mm/pat/memtype.c @@ -950,8 +950,7 @@ static void free_pfn_range(u64 paddr, unsigned long size) memtype_free(paddr, paddr + size); } -static int follow_phys(struct vm_area_struct *vma, - unsigned long address, unsigned int flags, +static int follow_phys(struct vm_area_struct *vma, unsigned long address, unsigned long *prot, resource_size_t *phys) { int ret = -EINVAL; @@ -965,14 +964,10 @@ static int follow_phys(struct vm_area_struct *vma, goto out; pte = ptep_get(ptep); - if ((flags & FOLL_WRITE) && !pte_write(pte)) - goto unlock; - *prot = pgprot_val(pte_pgprot(pte)); *phys = (resource_size_t)pte_pfn(pte) << PAGE_SHIFT; ret = 0; -unlock: pte_unmap_unlock(ptep, ptl); out: return ret; @@ -997,7 +992,7 @@ int track_pfn_copy(struct vm_area_struct *vma) * reserve the whole chunk covered by vma. We need the * starting address and protection from pte. */ - if (follow_phys(vma, vma->vm_start, 0, &prot, &paddr)) { + if (follow_phys(vma, vma->vm_start, &prot, &paddr)) { WARN_ON_ONCE(1); return -EINVAL; } @@ -1084,7 +1079,7 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn, /* free the chunk starting from pfn or the whole chunk */ paddr = (resource_size_t)pfn << PAGE_SHIFT; if (!paddr && !size) { - if (follow_phys(vma, vma->vm_start, 0, &prot, &paddr)) { + if (follow_phys(vma, vma->vm_start, &prot, &paddr)) { WARN_ON_ONCE(1); return; }