Message ID | 20240614221525.19170-3-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 D3B07C27C6E for <linux-mm@archiver.kernel.org>; Fri, 14 Jun 2024 22:21:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D5726B016A; Fri, 14 Jun 2024 18:16:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 783DF6B016B; Fri, 14 Jun 2024 18:16:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FE0B6B016C; Fri, 14 Jun 2024 18:16:43 -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 2895F6B016A for <linux-mm@kvack.org>; Fri, 14 Jun 2024 18:16:43 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D72ECA09AB for <linux-mm@kvack.org>; Fri, 14 Jun 2024 22:16:42 +0000 (UTC) X-FDA: 82230904644.18.C858C58 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2076.outbound.protection.outlook.com [40.107.237.76]) by imf27.hostedemail.com (Postfix) with ESMTP id F391F40017 for <linux-mm@kvack.org>; Fri, 14 Jun 2024 22:16:38 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=Lgtt847O; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf27.hostedemail.com: domain of shivankg@amd.com designates 40.107.237.76 as permitted sender) smtp.mailfrom=shivankg@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718403396; 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=paW7JLDrtb2aRBh8FzyCeKkpvtBTLuIly2aSw6Q9hHE=; b=W+XUPe/VYm3gxxV8iqxGgWJtp6/4dEZ+ifkrjZGRwHY4N3rLh+qvYudQRWwd2j/nRdM7Sm Y8Sl9MKOWd/UZR9lXJ4zTlLJ2wxLmBJcyJCLQrC+hOvtYRNZFMICpvT71+ttfe5gC2hh01 Jqh2zBzv7FIW1NOwIRloK6PuC3BmPBE= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1718403396; a=rsa-sha256; cv=pass; b=Bd4V4/93azgG885X2l9Y1IgTtCfnVfqL77IqCCWhbgGaEdyxbDwHcQt6uN/R7osK4rmyjO p28mgLFk0vzbBfW3UssM80nR5X17Z+YkiET4PJ1H9nFSwOaoGxFERY2EXrR2DR3YVajQ4O Djh84DTnS2eEwCOA2vtm/ClT8zkEskk= ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=Lgtt847O; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf27.hostedemail.com: domain of shivankg@amd.com designates 40.107.237.76 as permitted sender) smtp.mailfrom=shivankg@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TGoifSAYQdAFyDG87Rh4HGXN6IL4niu0kHRb4lJzmJ0Y5F7G+rNkBxZEmOjOoJs4jjFRotXSYdfTTbzcmotTZP1e+yCUlH3IO+I3Iq7XRDGz0z1vw32epp6PupSXZkQWFftdBU637vIzFFkmWncTjKHKlceu42oAWv/TbE6OmwIzQDYS1RHJP9NJ8KMWY0/MqyfF0bjzuy7UjdYHSpuRte45d3F/eRmIhsMaD9+ZIEKmRfekRMZRbjqLpBmyp+11Y9a/iR8WpwPsHICKE/EevYrUy92md1K6AyHVpGR017VIcLBypMrDYwY2CjCOh+4bQbpHax82LNHdE1ukCQjh0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=paW7JLDrtb2aRBh8FzyCeKkpvtBTLuIly2aSw6Q9hHE=; b=h1AVitlkXzkTxsuzq4aYDKxYNBP/ZbV+5nMfOx5sCI8CSAJ/LhwQ1F4J76feJRuYL5xrpn9a+gG8oBMg2R7ppw7gVMi59SfCJ1DlyTPUoggBVt/meYlLOW0U1uUnMJ260a4lg1X1/IGAP4NCD9gCPBQ7pFHeqUYspfuYsCafaQdq610tWyDKux1GYXG7WSW+FmNFMkRJsTMo3unW4Jf/MV8hxWPi+Zu9ov+1lFhURMGhhyJnwA0V2MQmxtVRF5WkIKKv9W9vYCKegLLy24T5kciY8IPAAb9GEU2/iUDAOBkKqju/S2Zg8oAe/KNe159p1jalUY2L4pdnzHwsEVqN1A== 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=paW7JLDrtb2aRBh8FzyCeKkpvtBTLuIly2aSw6Q9hHE=; b=Lgtt847OkXGePRrNBryWOZsZN4Y4QqpPsVMQ05KddIiLgQIgcSmCir7LE4li1MnFP33h+60+D/9qwB7Czi1ZpnFypRTvj2CfV63wUGfdLYBqsJp7RAAHpEcrSbIz+th3nyokkERJ61BFsnqErjX8J8RC5eS4+TCOLZN1bealFTA= Received: from DS7PR03CA0199.namprd03.prod.outlook.com (2603:10b6:5:3b6::24) by SA1PR12MB6727.namprd12.prod.outlook.com (2603:10b6:806:256::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.23; Fri, 14 Jun 2024 22:16:31 +0000 Received: from DS1PEPF00017095.namprd03.prod.outlook.com (2603:10b6:5:3b6:cafe::99) by DS7PR03CA0199.outlook.office365.com (2603:10b6:5:3b6::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.26 via Frontend Transport; Fri, 14 Jun 2024 22:16:30 +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 DS1PEPF00017095.mail.protection.outlook.com (10.167.17.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Fri, 14 Jun 2024 22:16:30 +0000 Received: from BLR-L-SHIVAGAR.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, 14 Jun 2024 17:16:25 -0500 From: Shivank Garg <shivankg@amd.com> To: <akpm@linux-foundation.org>, <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org> CC: <bharata@amd.com>, <raghavendra.kodsarathimmappa@amd.com>, <Michael.Day@amd.com>, <dmaengine@vger.kernel.org>, <vkoul@kernel.org>, <shivankg@amd.com> Subject: [RFC PATCH 2/5] mm: add folios_copy() for copying pages in batch during migration Date: Sat, 15 Jun 2024 03:45:22 +0530 Message-ID: <20240614221525.19170-3-shivankg@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240614221525.19170-1-shivankg@amd.com> References: <20240614221525.19170-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: 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: DS1PEPF00017095:EE_|SA1PR12MB6727:EE_ X-MS-Office365-Filtering-Correlation-Id: 31bc017b-1066-43be-6da7-08dc8cbfa480 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|1800799021|82310400023|36860700010|376011; X-Microsoft-Antispam-Message-Info: VwoEtAfxhdgsi/0NL9sxq39rO9UUHOlRfptpokGYLuYcAehJaOwcgHCySlliGmYjB4fjysFl9ARUweKhrIpzEYzSaXN+//3neIMPhsy6zBxXelKcSFn3Ol/YBcQMa2TeWkd8RL/6C25vatTe9bcgjJuRczi5ZEmWV9Kelyf2KQzL4KRMRy4VfuYlOJBtwo8nVmuZ1YOK0Fsz6/9OGJgvtbM61Dkcm+zBHMgkT/9z6r+lMBNL3I9J3GqxVsD+wDrPFpG90jQRvwM+2Abvct9NdnVvdd14Xnvv+84HHpiZ692pd9X4d63cpNM8S5oRwid3MZggHuez1EgnlYK9WPLzsNDih4w20R7E6Mq3u34ZQQhMyB5vDfTATiZ7Oee1bEll6r1sBeYXb9L9zCNAid7DQndoiyGg13+0c1zichoL23fQwsXb/YZ0uO7IyaThPrkV8eIgr6FhHUsTXRKg1IKxpJX5apH+pJ/G7WqtvFSM742Pj1DswRUVtRjcdm5msVY94v9pHEpWL5PJFxsootguC75vJnUwJIOel6r/91pTlp4MGmOFJc83Cx7y/4zbIek6OboZlu6krknCnWA5Y9tOoMhqbfAIfuYSNbGksYPYq07gdFy4sD+WS/D9gncEIHOsOQp0jPWyWMG9WFHR6GshI6Kqm+UWpOGIP8dh1Kj7BzXwMXASUEXKYhgD+vTJCP9cwW5MfaqYPYa3pEoWOItUFhH5c55XmQRkINzkeytVhnMUTCnUscAtN+KxHK1sqB2/FuJC6157KpoHmWxu9Qoi+D9OXN/WGhMQK5TtQRFU3TIFL7h/H42YnuOzTcNVglH35WkPSXA90TevfO6BhWw0bRpxVKRtyonij+Hz9TwZ+GmFk5XajSwG65fOpVvIzbrxzj6QyYWwoXVwR96fxQEyERlis/soot15z1IDUuvL9YvbOLyZwBTd9zLxbmMFKMwpRuu/xYFfcN5sekrjOckku73rtm/zn1mApEPZJ6iylVKjcbWNHWUUyRgJ2dted+1sPOgrUKIM633wNY+81R1HS6bJIc3xOTyevcXNqMWbKit547wv20/rC6fwA7xLg3rhcnlYvpCKxotR7lJ7mD1zs5XLBmcy5NvVPrTWA823khtlI3OlQt1h11hnVtib47XiByxqMeuTTT6gFty6eDizx3G88X7PvMJi0ydSLBCbM8JRJXQLXt9o0IoI3klrVpYOAI40CoGvC13DBeHxwfKCvtKIPhZP31aAeaRre1cTddP3s5wEhONtZoe2MCQdFsr02MzJz423Ixy28WUlSqkqJ6+y30JVFqH2icCMzIUE1Ka+nPea+gGIZeUXxZVOOzX1jjs+2WLBt+/mmRVaqNfEoW8FY4bO6v7FQvyin+pu9HxHXkQVCDW5qx6JN8RfeEj9A1WoOpjZJ040Aqfr+NoYJA== 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:(13230037)(1800799021)(82310400023)(36860700010)(376011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2024 22:16:30.3321 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31bc017b-1066-43be-6da7-08dc8cbfa480 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: DS1PEPF00017095.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6727 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: F391F40017 X-Stat-Signature: gsg8mi1wgz343q3q5wse8eshdpgadcue X-Rspam-User: X-HE-Tag: 1718403398-339145 X-HE-Meta: U2FsdGVkX19OnGkpYBVvQpDFUU2GaWtLStcgO+tSF/aAFxt48FoPg0ABfou2DTE3inesA3+RBvykHc1XD88dPojAbkomr6ajU4XMX6TghPGXvgirx4jmY+siOvNw8788MpDAmPofHmVZcGsQ78mmsphCsZt4U8K1sZh4Ozq6I4TfljxpbLUKjw93AkBn2qBfEL8gpccsYAIQew5SVFAie8z0rSMT8GHJTGW4aSMRYNr/3OJPFMRm8aePwGcPqG4iqwBKtUZsbMyNUzpE7DFC2r73oUmnfxbU5jcfcrghNqDzIiwe5wPHdLOPBJGoQ+id1wx24Cz6NZSJbSPB8b1tIimKFj9xIWyhD778r0A+c+uQaEmiiaV6y1yRD20hxWT2nRdSBmBg4yjJhIR5d4WI7s1FM/PQsecn6KEURVrB8zYE51fLCTFrn735zWbZ68/IvaA84y8XJx9OWemERgFM28AMOV/xtS+vij5l1KDaBMsNya6dubEU+8up3AsgbHeJzS9xxzORj1q3LLFUvGYHBH0/MMCHFi9/s74h7D/oa22XxQ98oZT9xZarWHBQ86XP+H9KpR4vsBjnsXPjmmLYApmPxapVuqiliuRx4OMwoaBtFgs/2U/cUhwPW9Bbn8apb+hTSwbFks7bIZ4ZmOaUD5LvJT8gh5/1jl2hYpdCHpoy3I7oh5QNMAG6UV/lcKf1Y30FmX/tRBZHlWtvM+9Tm0nQIlQ6W/+GspFzl4iEG3jVw6JI7BWfoPqRvcf10Auf206bogEtjGjnlzFVVJAdr5VKED5PRRjlMLKM9jhKkRRZCZnVYEyF1miFVefRX+strbyrWhsyNcdj+0GrUXmUAsEsZKfbAbgbk+sx7dcNdv5HGmeNN/Q0YBajJ/KFOgqV4EdPxUqPT9ePftlDzqPD0w4JI/RO0pr2OsODISx0IwhlRQ1+VYas3Eemo2YHccO/RlaDVgIvJVWL3uJBYZB pdenTEgd 90I3kd4I/NlH+/uvlSoaGkssZaIsA6sIKdr0R5Et+6f/1XUEoRfkKQ0VEkIMuUQ9R+Z2OELLd8bRfYsoKQhJh3DSbKrYTzFMiirJ0m71zIYEeG5CZbNHds6VjQ/GmTMUltRtnvq4vvhFqFpCM1bsBdXoRFEtDGpEHsK2CY69y5oVYzCOdGxOPqmgkoCpcBz5TExQddeZLH+94hS7Hd8qc7sXnKve2DseAqOb7BXFsXZDSOpn0I3vugRVg4Hz7dJhdYCuE/yzs5Al3y9CuKwIiw1zyaNQkSgaz2wlQTvkUfgfKuBA6St1uu+Xlm7vEeATJzfeDPt70llOsugtLM6uNJYzGWFv4VbC5JiJZui03N3oeOktVsqySs/V+RUlPj8oCXaY7 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 |
Enhancements to Page Migration with Batch Offloading via DMA
|
expand
|
diff --git a/include/linux/mm.h b/include/linux/mm.h index f5a97dec5169..cd5f37ec72f0 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1300,6 +1300,7 @@ void put_pages_list(struct list_head *pages); void split_page(struct page *page, unsigned int order); void folio_copy(struct folio *dst, struct folio *src); +void folios_copy(struct list_head *dst_list, struct list_head *src_list); unsigned long nr_free_buffer_pages(void); diff --git a/mm/util.c b/mm/util.c index 5a6a9802583b..3a278db28429 100644 --- a/mm/util.c +++ b/mm/util.c @@ -811,6 +811,28 @@ void folio_copy(struct folio *dst, struct folio *src) } EXPORT_SYMBOL(folio_copy); +/** + * folios_copy - Copy the contents of list of folios. + * @dst_list: Folios to copy to. + * @src_list: Folios to copy from. + * + * The folio contents are copied from @src_list to @dst_list. + * Assume the caller has validated that lists are not empty and both lists + * have equal number of folios. This may sleep. + */ +void folios_copy(struct list_head *dst_list, + struct list_head *src_list) +{ + struct folio *src, *dst; + + dst = list_first_entry(dst_list, struct folio, lru); + list_for_each_entry(src, src_list, lru) { + cond_resched(); + folio_copy(dst, src); + dst = list_next_entry(dst, lru); + } +} + int sysctl_overcommit_memory __read_mostly = OVERCOMMIT_GUESS; int sysctl_overcommit_ratio __read_mostly = 50; unsigned long sysctl_overcommit_kbytes __read_mostly;
This patch introduces the folios_copy() function to copy the folio content from the list of src folios to the list of dst folios. This is preparatory patch for batch page migration offloading. Signed-off-by: Shivank Garg <shivankg@amd.com> --- include/linux/mm.h | 1 + mm/util.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+)