From patchwork Fri Nov 1 07:13:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivank Garg X-Patchwork-Id: 13858842 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 8DE30E674A8 for ; Fri, 1 Nov 2024 07:14:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 173A86B0088; Fri, 1 Nov 2024 03:14:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 122F96B0089; Fri, 1 Nov 2024 03:14:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F05B26B008A; Fri, 1 Nov 2024 03:14:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D3E366B0088 for ; Fri, 1 Nov 2024 03:14:39 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 603DA1C7B21 for ; Fri, 1 Nov 2024 07:14:39 +0000 (UTC) X-FDA: 82736661966.09.7450F05 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2088.outbound.protection.outlook.com [40.107.100.88]) by imf24.hostedemail.com (Postfix) with ESMTP id 8CF65180018 for ; Fri, 1 Nov 2024 07:14:32 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=gYYkADr7; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf24.hostedemail.com: domain of shivankg@amd.com designates 40.107.100.88 as permitted sender) smtp.mailfrom=shivankg@amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730445114; 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: references:dkim-signature; bh=ktLReD6tYjeMCJKpTiEmA3iBkEtoA/C7FqrgqH7ZQHE=; b=RR82sGI8rZxkbLSAlW8TVaeFMQ8JsBdCafnWFH1Ns8vpkUoHh5se5qxkou5C0v7iys0i8l UaA6qrcyc3js7bpxgNXzmqX/z6vJJ9Z+vnYUyyxKdBjtmTAk7HGTmvW9sj/zT/u/AXYTYB AjjdTArgDWXGapNSIRUTHCcUHO/p/gw= ARC-Authentication-Results: i=2; imf24.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=gYYkADr7; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf24.hostedemail.com: domain of shivankg@amd.com designates 40.107.100.88 as permitted sender) smtp.mailfrom=shivankg@amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1730445114; a=rsa-sha256; cv=pass; b=JAWp1Uw7rJD+Yc4DubfWPjRzc2XJCjXcIaPuksMwrG7+GUD0UUfxk5Yg9bJIUltygcqHBC mc8lH5iQ5YhzW1ObnHlTYQ1Na82/i3ywNV8VBW+xaOjTFD6uB/nzxzAW9JMNqJRsBM8xbj rbyUuhYa/ifAeB5+S4t5OsIeTJ+3wLY= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vLxA74oaCVKwi3C+bgGBwZzXBNtV7XuBgxXrQQaWdw07wUTyOk7ACPXmmk4lNRvYkgXK9LmRRx+0ihxjJ3ASmnBTvll++AJ5HNBP3VJq+jg7MBjbDi+iedRskcb5a9tEl/SsNSMBY1xxBXq4TsSuZFtTGiK2qtqDADSjwq7Sg2vXLNkjCzI5HFhPlBETavFoSMZxRIf/Xn79s+b4GayjjmZp2DyvrQtfdQeXUmpdnWFiCP3Nd1SOETb3El+pvP3pWZqB9eEMus8JCaZqCUVuPTyqScs/Epbil+aHa7ECUm1utd4rSyf0rpryKJJSeUlTOW2gILw1MRk3F0J690h69A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ktLReD6tYjeMCJKpTiEmA3iBkEtoA/C7FqrgqH7ZQHE=; b=Fm+CJmVXPzOdh3OXMyDmSSiFVzW0yQz70Rwy+qAOxbyAFrjm25IjvvVGPFSninZf6HgyKrwdo8aT9GUmzu2yjNrPFOx47fGKJ7HpI1oWkpkTKCQZfD02aUMMyh7TrCw0ZwoKcpiqfx7rTMzPPS4d9N3928Y0T1poraPmqed8oD4T5UX/LCcQGHxpkhxGkGHJVtr5MBT9gH6Jb9oQFzLE+zeepTX2WwSfgjzbNyYO48JCAca2OvknnKeog+u5TWm+dluJqIpQKpCseI4TYBZHXu4bth36p6o0ZsfX0hYZF9DRrud7nHvzXdc6SJa1S+IvaH56BbRojrhx4QmCQDPcSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ktLReD6tYjeMCJKpTiEmA3iBkEtoA/C7FqrgqH7ZQHE=; b=gYYkADr7ghzGaJ+2oLEfgDodCLWamem90p7bM5UUpvXLHjg20+JuLVVuYZx6Zf/zhqybRRwynRTLXk7EhRIAYz1apd3aZijG/aJ6UxHX9sgz4jCTsQ7LOgj2jadOb/5w36SrkMGzaLAggI6Gy2HbHa/8VPFQeLpMHZQaHflq5bE= Received: from BL0PR0102CA0065.prod.exchangelabs.com (2603:10b6:208:25::42) by CH3PR12MB7596.namprd12.prod.outlook.com (2603:10b6:610:14b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.23; Fri, 1 Nov 2024 07:14:32 +0000 Received: from BL6PEPF00022571.namprd02.prod.outlook.com (2603:10b6:208:25:cafe::7b) by BL0PR0102CA0065.outlook.office365.com (2603:10b6:208:25::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Fri, 1 Nov 2024 07:14:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL6PEPF00022571.mail.protection.outlook.com (10.167.249.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Fri, 1 Nov 2024 07:14:31 +0000 Received: from kaveri.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 1 Nov 2024 02:14:25 -0500 From: Shivank Garg To: , , CC: Subject: [PATCH] mm: use vma_policy() to get vm_policy Date: Fri, 1 Nov 2024 07:13:50 +0000 Message-ID: <20241101071350.402878-1-shivankg@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00022571:EE_|CH3PR12MB7596:EE_ X-MS-Office365-Filtering-Correlation-Id: 9db6e976-2950-4a37-6b28-08dcfa44d527 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: 2qcMKscPsdJoSPJuTMl716D8OMr0Yqwki9IxtCqCM6sjPyLo3u8wS/kLWMOl8CKEHp1vPx+bbCAxLOWzqYzTnx99pQ+FuUgIkFvZcmcKR19t3DYu7po1PUUBmeLzgAWbXqR9RzsA3UNHnELmQocoQKFvWjBKMMQbhYU9NwUsFwdn9WF8GUm6Yrrdm+iIAaAdzQ+VC/b4U3xfyGBfF81Hf3xdCgBwsCi75prtmj5S+iQ1Ox1LCiJT94Yw7HiK9nrXNWMH9VeMmZNyGgOIvVSGQfgXA5JMJNRBMPtqMUYzhdkoXTo4eq8yVL5iDZlFLK8r1QRc3+BToSSQ/A0yaEtdnd7HkVwwFtsAk9yDpH/uGUluu76TvqENE562I8NHlM+8iAtqXoYbPz7DE64orC3HzVZigHeVDOkwKL/lyzW5AUTHNzbyR+oI6Qr8jYtX6BxepvuAL7v0uE6Ce4Zc1mUX/F9YZz/0D6OZQTLQEt0qC9X6TR4FoDehXkVptvJ0dSeIRhmjC1bd/iTmuaK4AoLBnbDFTKm8BBzvSjBJ50NyiDaXoO19O7rYE17grhALjJg6UG/67RRZcNLODqmwCwr13HWj+NlH78l1KPWkeumlmcggYNxtXT0N0dOpLBoZ95BBb2zYaXyO6xE+QqSOfGb+BnoDqcD0BUXSzL1ilO3nuOVy2y1PwUQEoWgJXXksk4KFjJnbY/K1q7AYet5naNym8QgpNiotCpVgYZmb/hn86RdWNrPGgVRicpSLIjWnsC0/iB+krcrxVDVjJ+9N7oneoMOXONWaTP5VFQzmp97KeJMaGFO0kwSuVit0QJ/PhkGnxoVbhLROZAbbY2dXSNvgEhUKUW3cfh/Li1Vuvxm7TlhL+UAtnMoGoHbG7uYNOqTHlOG/SjL33vhw4mAylFc3uFjpkXu15c0dtaLZKMH7iM4sPeq5zYCcxfEfKkTGNaecXtvWjnInK1ySTL1O7XgX4fqwjvIQYvc1RowvroriKRIN0kK7+vrwSpy3ZLN3+rNd5xRCG59r2oBbpDdet/8/UWUT2CzuoHTuySCBEB/PFRvhm4trEXyaqbg8zN3nOEFLm2CrpzuFLDFxedCa3mgotO7jcBGR8i9mgozcynTBmLRbYhiaQvyh3d+fHdR7BSEuXJIx8BNnkHs1pQx2gYv8gJMiOLBimsqPJglqZQp+HVa6DKNxCdsi7rsIBFyeoF91gqRST1tJT56+BRsJuijBE5WNz3eC1Cwi6lvuqDJGazYd9tCvDdhWKt7jHiOnPY8ViOCcvoDyA+wM48r4VpJvduo4zRXfOU/EuprqcOI5FVhcCzJ/jjpNS9sRMZNDZWo9htnSUpEfZpKoGbuDc874YQV24oQ9QeAHV0xknHNinb4HwsfeM/GhJ7ruq5r6RC40y3YtmVZlH0o/ibsieGyl8A== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 07:14:31.9837 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9db6e976-2950-4a37-6b28-08dcfa44d527 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00022571.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7596 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 8CF65180018 X-Stat-Signature: im9o6rd44f7jjxbn6po1czt33noftdm3 X-Rspam-User: X-HE-Tag: 1730445272-62103 X-HE-Meta: U2FsdGVkX1+X3um4MbXhx2woeRFi0/u1KgAdMnWkfLzBHd6Y8qqhCN4GNFWH9dWcU0dcToJXzI0ZiIukczQSOBbFCw1dkTK1Fe+XYmJbs0Yij/eNdwTxmahQKgKgJ3N27g81UvAYEEMGxDZg2YO0/6fJlSYpi/aOu2zEYeHIdRl++lMJGxGLigRbwCaa8JjptfP2Q4afFcHty4BYaYY4s3T85QYB9YMDJLZ6c20EiS6C9Kbo7zSgLnX6o9Xe6HdN6WlcjnkKl5S6jtVaKDGfpag0x0A2JGk0ge03rd1IululZf91jLJeCa8JJLF2bxq0jnTLGpIvA35J8Yg/lBHgaqVWycUZCwV1nko/7CbFN9/Q2pi09AEh7rdF7MvGySN773Es0zVsX53x4r0B1gFAq4YrV/ZmNhONhVqx9dC9drUhZRCOlJVj33dYbcPDJRDMUV/WDDBt2n+72eTlHTXagRu+HfKIfn5mo1JZG1lNofFbU32+Iv33nMh0SbWUoJ/Cbh8lLwaeRpfozyzjTp0B0Sfcpxe/Dna/e7ZFTrpdRCuxu5aSWLqU+wT0kurA/4TDn32C32I1fTwjz7RW8LYOc7QTjNVaHwX3Xv9wE6caNfDEif3gZFN85+YTnMCFPJH7YcupegZsGQ9WFiUjiQHlbQt1DCfUWgrLJ/eJYcUmicQfAbauWKv5giab6C8BveRokJBxkJdzIn8bCw2DfXRTCLm1Wrceq4zosW5XghHSsUZMZZeVh5JGmbLTB8w4EsRomfsrMpFYbzGQdqmzRxOOqvIk9p6XjXoECj8eqNrmvzBOyJ4OSzf6FNRUqlPZYQuLvUuUjY1Q99leF+3i3HRPa1aSsMFduzxuSUN/zQ0ECn2hIspHv2VUhFuJhiApHsQjbTZ9FDJL3jbqgHbr+WdzWuJVBYrKDjuCu8efqEdg2doYlh865GjgzuCFXg4EbrQ2MYZzRLJIjWkiqGrbOSQ WtfyHNCQ A9K4hn+vaf7aEO/ptK5WMN9tLWZCVknUcoZyusEpu4F/qrH/2JiBMeRaAVAY7f/JgOto0xsacZG945KnJosAdj0p8OxCDLjTtpTk7YEzU7dz3C1rb9Z8boLuOEOzT/+vX3voS8J0oqu5q3bB7+QKe4IHnMLTrEFgtlCd/x8ccUqnX7GGqfqtot6BZGUciyJG/E4TQVUTPJ9L0IdFYkjnOu/ytbUTjsN3j2zuZyf8vq49EuB5pXZTJawZAEeyD/7nkAAvNa6XHCmgyCsCkxViuTur4XPzJBxOvvSbdKLCJSq/TVwoRB00pGxUdRV0k8LX6L3xOL/50AvonbRL3sxeAWipPSXbmJktrhoUNeJo5zk7PDHBHDxzXwnzC0VwG5rpvuIIBmLhgpc6sGgSfpu7BrTdXYrjmyoMFcu53yPc47EsDe2QHJXwsCSLN2He0tX+9J48jgS6PQPUTkJh54irflozoJtdBlmlwxIbcHQEdyGy8it7pLp65WyKkmg== 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: Instead of accessing vma->vm_policy directly, use vma_policy() like other places for consistency. Signed-off-by: Shivank Garg --- ipc/shm.c | 2 +- mm/mempolicy.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ipc/shm.c b/ipc/shm.c index 99564c870084..ebd45e48b0d4 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -577,7 +577,7 @@ static struct mempolicy *shm_get_policy(struct vm_area_struct *vma, unsigned long addr, pgoff_t *ilx) { struct shm_file_data *sfd = shm_file_data(vma->vm_file); - struct mempolicy *mpol = vma->vm_policy; + struct mempolicy *mpol = vma_policy(vma); if (sfd->vm_ops->get_policy) mpol = sfd->vm_ops->get_policy(vma, addr, ilx); diff --git a/mm/mempolicy.c b/mm/mempolicy.c index b646fab3e45e..7ccbeb9966f0 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -420,7 +420,7 @@ void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new) mmap_write_lock(mm); for_each_vma(vmi, vma) { vma_start_write(vma); - mpol_rebind_policy(vma->vm_policy, new); + mpol_rebind_policy(vma_policy(vma), new); } mmap_write_unlock(mm); } @@ -805,8 +805,8 @@ static int vma_replace_policy(struct vm_area_struct *vma, goto err_out; } - old = vma->vm_policy; - vma->vm_policy = new; /* protected by mmap_lock */ + old = vma_policy(vma); + vma_policy(vma) = new; /* protected by mmap_lock */ mpol_put(old); return 0; @@ -830,7 +830,7 @@ static int mbind_range(struct vma_iterator *vmi, struct vm_area_struct *vma, vmstart = vma->vm_start; } - if (mpol_equal(vma->vm_policy, new_pol)) { + if (mpol_equal(vma_policy(vma), new_pol)) { *prev = vma; return 0; } @@ -1797,7 +1797,7 @@ struct mempolicy *__get_vma_policy(struct vm_area_struct *vma, { *ilx = 0; return (vma->vm_ops && vma->vm_ops->get_policy) ? - vma->vm_ops->get_policy(vma, addr, ilx) : vma->vm_policy; + vma->vm_ops->get_policy(vma, addr, ilx) : vma_policy(vma); } /* @@ -1847,7 +1847,7 @@ bool vma_policy_mof(struct vm_area_struct *vma) return ret; } - pol = vma->vm_policy; + pol = vma_policy(vma); if (!pol) pol = get_task_policy(current); @@ -2559,11 +2559,11 @@ unsigned long alloc_pages_bulk_array_mempolicy_noprof(gfp_t gfp, int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst) { - struct mempolicy *pol = mpol_dup(src->vm_policy); + struct mempolicy *pol = mpol_dup(vma_policy(src)); if (IS_ERR(pol)) return PTR_ERR(pol); - dst->vm_policy = pol; + vma_policy(dst) = pol; return 0; }