Message ID | 20240919094438.10987-4-shivankg@amd.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 86B15CE8D64 for <linux-mm@archiver.kernel.org>; Thu, 19 Sep 2024 09:45:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14FD56B0096; Thu, 19 Sep 2024 05:45:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D7126B0098; Thu, 19 Sep 2024 05:45:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EBB0C6B0099; Thu, 19 Sep 2024 05:45:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C746B6B0096 for <linux-mm@kvack.org>; Thu, 19 Sep 2024 05:45:28 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 84B3BA0B93 for <linux-mm@kvack.org>; Thu, 19 Sep 2024 09:45:28 +0000 (UTC) X-FDA: 82581005136.21.729DFC6 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by imf16.hostedemail.com (Postfix) with ESMTP id 9087B180007 for <linux-mm@kvack.org>; Thu, 19 Sep 2024 09:45:25 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=AhlQYqts; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf16.hostedemail.com: domain of shivankg@amd.com designates 40.107.236.41 as permitted sender) smtp.mailfrom=shivankg@amd.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726739000; 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:dkim-signature; bh=t3TqfD3ymF6eqT4nlqJNmccBGoGKxBelhDPWPHnJ0q8=; b=IjB6eGHBgdp3sh3OQ4PmpM28dwyi1F2rn6Qs/gKqxKW7dHBodQeQyo+jtEWR03E0QlzU+t RYsvuOfAt8AMMABizkZ09w4AS1J7CQQqTS9LUzpp0L4NFl7NrIwqHeFK7cwPAUFu1X/a+f 0yEQ7N5oWH2Kp+77R+gxEQSbYk4Nf5w= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1726739000; a=rsa-sha256; cv=pass; b=ENjN7Kl5muOFynnHlBsOqp5YKwvcanz8fGMdT+nhVO2zwn3+yK975r+oRNctFWImdl/IV9 E+YoorVF5PBfqbhIh+R9AgCouzKXFGRx8xopBF+l12cA01lSKP8Yvar2ZowP9BrdCDddIU Ucnj5qYVNbsAUu8phqRyJGv8CO5vNDU= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=AhlQYqts; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf16.hostedemail.com: domain of shivankg@amd.com designates 40.107.236.41 as permitted sender) smtp.mailfrom=shivankg@amd.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=T+/r3YmQNREDWg3zA3VcBAHmLBjLCq6NPvLuqy7k/3WY7TY3jYq3LLXCxwQh1QucbXr6/ZUbgTOrPZN+gJWHptiIqyz2hkqNAOvfRsh9QLpxer9LHX4vV0ErUQpcOUwn8FEM7Ag/ugqeZ7uORi/TxY6ZuugGfkX8SO37Vt5AEKDrBBxkbKIjzh+4xao8O5CMMIjij1z6/WrXQn33FC8wG7au9EISBlHE6qg48MU51jaNz2oVn+DOL0A9gbCJJ/85mzBdekwRFo3zCAx7iX75uxfiYkmv/rpBhzZH2mfKyFtiRo8TaAG2RbpZg95j2+HY0zZ08KAbi1OwvR85p+SKWg== 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=t3TqfD3ymF6eqT4nlqJNmccBGoGKxBelhDPWPHnJ0q8=; b=SOCsn7rRaYO6k4af9vn/53JJEZi7H1/WUP4n4otLqOQOaEYm/Yatm38fJQvkKFiiYfO1r6kUQsJmxWskLX7seXdcoo95YmqqdvKk3SuKAdNnllcc0/kRXcb8Y3uBCcWwZxi3biyvG1S0NcH8uFQ2Me01LcEW+diJMYMaOlS4aIWqKuJ+3NGG/tV703IaGIzuLxFuq5AXQduvC2kLyxqB0SotxQi9raIkTHV9iw4XYHsaurkpvqhTyUaCWQBuhtqmtJDx6jp5Kc0VEc80T1NqBr7oHpxQ2SEJ0+OQfK+/JlajGWW0Hzen5lnUlKE196QW7MSatj2dEyAD2MwgsHoeYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=t3TqfD3ymF6eqT4nlqJNmccBGoGKxBelhDPWPHnJ0q8=; b=AhlQYqtsfKDtZkZO2ypK528CjR61zshfcssxtXD2+6GT06xahb9TIt76EEXVEG1pDrdMQj+/+OD/a1OJe7WQeBXV1qYeCi0bBcFulbABHZWdoM92CxQ7/HrQewPKqNDFLDh2ve1q5ETPYWm/GZvPxaCKLkErzPMgs5W2zRNQ5bQ= Received: from BL1PR13CA0402.namprd13.prod.outlook.com (2603:10b6:208:2c2::17) by BY5PR12MB4307.namprd12.prod.outlook.com (2603:10b6:a03:20c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.21; Thu, 19 Sep 2024 09:45:20 +0000 Received: from BN1PEPF00004682.namprd03.prod.outlook.com (2603:10b6:208:2c2:cafe::20) by BL1PR13CA0402.outlook.office365.com (2603:10b6:208:2c2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.25 via Frontend Transport; Thu, 19 Sep 2024 09:45:19 +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 BN1PEPF00004682.mail.protection.outlook.com (10.167.243.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Thu, 19 Sep 2024 09:45:19 +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; Thu, 19 Sep 2024 04:45:13 -0500 From: Shivank Garg <shivankg@amd.com> To: <pbonzini@redhat.com>, <corbet@lwn.net>, <akpm@linux-foundation.org>, <willy@infradead.org> CC: <acme@redhat.com>, <namhyung@kernel.org>, <mpe@ellerman.id.au>, <isaku.yamahata@intel.com>, <joel@jms.id.au>, <kvm@vger.kernel.org>, <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>, <linux-fsdevel@vger.kernel.org>, <shivankg@amd.com>, <bharata@amd.com>, <nikunj@amd.com>, Shivansh Dhiman <shivansh.dhiman@amd.com> Subject: [RFC PATCH V2 3/3] KVM: guest_memfd: Enforce NUMA mempolicy if available Date: Thu, 19 Sep 2024 09:44:38 +0000 Message-ID: <20240919094438.10987-4-shivankg@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240919094438.10987-1-shivankg@amd.com> References: <20240919094438.10987-1-shivankg@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004682:EE_|BY5PR12MB4307:EE_ X-MS-Office365-Filtering-Correlation-Id: f510be3e-3ae5-4432-9f83-08dcd88fc63b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: CoH8PVwrVkFFuaqmWMh6HEMGGRoj7DTRG/ngW4R1N99ShmV/HedSKzqdxRwyYZbIX1jXfipv9L5/gEtxGGMxV+M205EkJTM0VOtzKZGKZbgmoUNV3wJr8A63IwCuw/VDU0xHwL4OdUM6XkuI3V5RxxAjxmM5UpBt5eUdAzGyYyqfGHaXQAEvaT5kUpqfO47hK52JCTtRsRHo/GBGlF76Bz3GNWxkS2s9hVvIB/e8uddp2Im7UOnBG12XEn7r2Ghq0qq6eS9l5o6hG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9ypzRdg7vGagZ/iwDM0yb1n60iteGMmESC2bxGh9YvjqcNq5LV5VKvt8TtaoVWUSiuVZTAKlOg2XLoyNGPzlXiWhWCBvLaYD31SIGGkQP105iPgiR1Ob21VlwNAvD9+33V 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)(36860700013)(82310400026)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2024 09:45:19.6861 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f510be3e-3ae5-4432-9f83-08dcd88fc63b 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: BN1PEPF00004682.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4307 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9087B180007 X-Stat-Signature: 1e8uhiyzmhzhugatkdciapnqmim56ox3 X-Rspam-User: X-HE-Tag: 1726739125-495163 X-HE-Meta: U2FsdGVkX1/uHI3KJjSyKnBfCde+EuuSAiPklD4Y2HRf5xlELYiGFfsOf4Z3MLU1JrpPPiL/ID/RBR+gfZnlt4hxhhk8pAfBDtkikmcQD2HxWPsaRksWDBCJpXnhgnSoJbvlxIGmm2uasCebsddQbdyLlg624MsnfUY4ZmoXiDzDpJVi93RBpvSInzBKh5hcbX0j6f/ZmfNhNGedHztJOWx77HUdvCy7SvReARu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oal7vuSKBs6/2UMOM8q6/HIL+E5s3V3PTAvtf9pTgqzfMRz2NV3z/HZ40egV6wvx0o7M504QmIT38Kbae23wtsTZ6qK5ulvYP8WKvgK4j7bValaDVSrt+iVuyBwENgheipbgIoA4= 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Add NUMA mempolicy support for KVM guest_memfd
|
expand
|
diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c index 8f1877be4976..8553d7069ba8 100644 --- a/virt/kvm/guest_memfd.c +++ b/virt/kvm/guest_memfd.c @@ -130,12 +130,15 @@ static struct folio *__kvm_gmem_get_folio(struct inode *inode, pgoff_t index, bool allow_huge) { struct folio *folio = NULL; + struct mempolicy *mpol; if (gmem_2m_enabled && allow_huge) folio = kvm_gmem_get_huge_folio(inode, index, PMD_ORDER); - if (!folio) - folio = filemap_grab_folio(inode->i_mapping, index); + if (!folio) { + mpol = (struct mempolicy *)(inode->i_mapping->i_private_data); + folio = filemap_grab_folio_mpol(inode->i_mapping, index, mpol); + } pr_debug("%s: allocate folio with PFN %lx order %d\n", __func__, folio_pfn(folio), folio_order(folio));