From patchwork Mon Jan 6 16:55:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13927686 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 6F317E77188 for ; Mon, 6 Jan 2025 16:57:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0AB3B6B0083; Mon, 6 Jan 2025 11:57:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 05C4A6B009A; Mon, 6 Jan 2025 11:57:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF1456B00A0; Mon, 6 Jan 2025 11:57:44 -0500 (EST) 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 BC1786B0083 for ; Mon, 6 Jan 2025 11:57:44 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7F8EF40DC8 for ; Mon, 6 Jan 2025 16:57:44 +0000 (UTC) X-FDA: 82977633648.26.8B375AC Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2052.outbound.protection.outlook.com [40.107.95.52]) by imf05.hostedemail.com (Postfix) with ESMTP id B4E42100006 for ; Mon, 6 Jan 2025 16:57:41 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=MvlTcKML; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf05.hostedemail.com: domain of ziy@nvidia.com designates 40.107.95.52 as permitted sender) smtp.mailfrom=ziy@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1736182661; a=rsa-sha256; cv=pass; b=5IGU72OW++rCPPaQ5vv4gbDs4pGLHrj7xfG5GymfWbJ+aNuACAXxdgBqggO0rm+GkaGEB7 tp4VRL6OsecLLr7nccUnFAz10Xuxf0buCWX6umveaBVlNCxmVobgUfNPi/IOSzS24OEM5m MSZh78/Y2xWU9Blo03kdi9A5UYAJxgE= ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=MvlTcKML; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf05.hostedemail.com: domain of ziy@nvidia.com designates 40.107.95.52 as permitted sender) smtp.mailfrom=ziy@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736182661; 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=8aaxMyT9ASTV30k4qhW4SCI939ummtaihJVCjY+zCFo=; b=XuDJ3f3x3qfcBv4nelTQOinZVSVV5uD8fS51R6aAW8H5W3nxlBqCPUCoElPntV+4bjwjNz hZdNWkdUAGU/VDP6RrTPtszvP6bfCs9QkXahZq1AVYsrlma1XdVRcvErjTsVcM0/el/0Km chV1UtwUSBN+TB7dr6bBgUCkSDwTaxM= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=d3qlnpOQPG6esOfrgMsuLtr7uLeDwmVZa1bFGEfw178PIR6Cy9DW8o9DFDteNbcHlE9CcX2XMZj/Bw+LoSYfSZtJExU8yBGDpy550zTPA+ULzF2h9DRbDMB14JeCqRij5dVdXyEX/k/i0EVu+c091yIZbzBFYU+nBCdbrEekU8j3uEOjns79OTPFz4QFzOPC8YndzmT7j6rS6chfWcbixvTURYHoYBM4skDG3+h3/mH/8V/eh4t6I7C1QS6kQ1BUPsZf7qDRQAOdIqPQpMYQRQEaeRiOp6G4Od6lXlLMss37Warr8lhHpjU3tus/5jM/WW9f1cA1SNaEjYoIHON4LQ== 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=8aaxMyT9ASTV30k4qhW4SCI939ummtaihJVCjY+zCFo=; b=pEFjmgUjM+l1kIpNlgY8Qm5ipXJ1+NMMlbBw2x6Qxcolx8na6o1M5Dhse7UVHrKdbyM3FUSkVMj262dmeHT1zN1uW8XCdKN3Q5H1ipzqSA8KSTJtt29rsTbCi4xeaAdziHoD1GpcWYHrEEPPDczM/SZmhgNwhBMndjtK/GOcqotZKupZ+YHLJO58wPYpRRQ+u+hNWazBm67dgTCl58dEqre1nxwbORK+vPRy9JNeXNMf8RIGrX2jY9EC5FnHX7ZGLUwhsLjD2y/LR8dChj0NJ7ZyZuogccCpgIZMbqfi4BIjzNaxVb3N6YcdvNTyWa7Sfzogojp1o9LlnhOL6QNxRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8aaxMyT9ASTV30k4qhW4SCI939ummtaihJVCjY+zCFo=; b=MvlTcKML8VSLq6mt9mjtbmUlW5Z5verRUGQdf1OM0CaruCjB9bs7cqzYqe+/O6BjTqpbr8Az+Hbtgc1H7o9r3TAIBYjc9w9w5Tv6qZtl4nO0O+j+KmmG0QuPa+sJ/oBkuSb7xp0/12JPkK9zX8qiZXc6wqxfLvZ2TnnbwT2qOZJzvHInYx2gpD1F1Fir7QX//6UKJpjRF80CnE4u2MQa2Vq2MLNyQJcb2OIh61OUOzmwk7psJm864Zh4TTnvls91halMP8BYghan1MP4fmNesP5X1FhdUcDL72D6fJzn5GFpaa3Zd+JL+tmafwq42FkJDNcG9GPs2rzSqbtg/DlUbA== Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by PH7PR12MB6634.namprd12.prod.outlook.com (2603:10b6:510:211::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Mon, 6 Jan 2025 16:55:31 +0000 Received: from DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a]) by DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a%3]) with mapi id 15.20.8314.018; Mon, 6 Jan 2025 16:55:31 +0000 From: Zi Yan To: linux-mm@kvack.org, "Kirill A . Shutemov" , "Matthew Wilcox (Oracle)" Cc: Ryan Roberts , Hugh Dickins , David Hildenbrand , Yang Shi , Miaohe Lin , Kefeng Wang , Yu Zhao , John Hubbard , linux-kernel@vger.kernel.org, Zi Yan Subject: [PATCH v4 08/10] mm/huge_memory: add folio_split() to debugfs testing interface. Date: Mon, 6 Jan 2025 11:55:11 -0500 Message-ID: <20250106165513.104899-9-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106165513.104899-1-ziy@nvidia.com> References: <20250106165513.104899-1-ziy@nvidia.com> X-ClientProxiedBy: BL1PR13CA0102.namprd13.prod.outlook.com (2603:10b6:208:2b9::17) To DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|PH7PR12MB6634:EE_ X-MS-Office365-Filtering-Correlation-Id: 119351f5-9689-44fd-4f4e-08dd2e72ee4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: mJtcRpNtk0qP1M8FqfIIa27c7jntiSARN7wCZH/AhBn5LFniQY3NKq+AIzVmCQHe4zXwd+QQHew/xWxGdwyRlGynvDX4qFJqtF2plb1S0U0ErbDRj9PBqaIiNDWNgtzjdNuzgA+UCfH/DsK1yBwTgIfhMjcEUq2YFnhJqHrmUSoG7Cy5OudnaT9HhkfAN79iV148a/luMVeZR6+UjJXu16I8GoVS+iNYZ1nIEBzhrfuzFCT26mzOaqlLTKbcTz869WSWja5DEU+/CgX5DojJSZ0sMH+JPGqQCD4mgqRVxpchQxBjiNzS4ncaKT26500QA2ZucwXHnS2t1c6d3uPlUIYzjJ+CWxDRHonUvBzkQxfyuD8PyrcJOfrhEpikz9eTAMgHhA2WxHWeoMoMlnv7IU9RUgxNF+ZHRRJHSTzPNlrv7l24p0h51m7PE1pHWv3xD9jC+X2q1HKM5WJa89OFQ204Ei6PWboR6fN+aKF1n8akBml2lXV5ZJmK7NxkRnwwVJRVyqB5NrU0+wJBKLkCCAvWfrPIFBruTgqomyYpRwJjlOIgsyDaL5aCRbTN+03htu5u95dv+9LAcm+8X1RYhh1eV2sMN8wZyBZmcYcIO24cwqC7mZl+CwBA0FeDfevOwWRhlbx/NDsllhEizTmRUHeVSGntZiDrReCTu6pMGU3EaVDq8JFbU+zl8Jj5R+//4T90EzGng4myscOaOU+YLUW/Nv2u/y3zhrd9TvRUEnUyQQOgam+IMX9rl569b55ZkUeaQAELtFW9dSflrMU5kEVPfZGrcF6/WP0LDh4+OXRW3/BU5eMivxh+fZMSCCO7LxrtetX1T3nc+Xt6IRILFs3brtwSmuhVO5Zi4LX2HEXp6Kk0EZLDB2UUJuGq2EV2c4h+yMyw2NtlxM+0+pBMRfiN7BhznNciN8JAPe98QaSahVQBkyLDgYvNKWdiJqUoV4E8EiUat94HSNjDQ6f9SrvjBkeGjYikdjZGAm+7Z3e8tFweUfiSYpgEg2UQlCXgvOtE9qXL/ZTjRKvXdMr66ZmslYwi2+FSSKgX8xSpcgXUH1LyHfymJM84/736WHS4UADI63cXAuGmN4/kA/VeTRopITvD8wrhKcxgZq7j2kRlwiyhMvQaLip5untnle+aWMpGPopN6xCZN3uFGnIM0q61qSfO4altMRuX+6oaGBgvQK8/zenFbYeGdHHJJh6o76SbVN2ThRzFQ1vfSvS8+5qlwH03Tf7S4r8+w7MNGVxEy1NLN2Pryr56c8+IDFzV2FZ3idS4GgQpv/egfUfIF66CF0kRiitrL88O7DTRpx4dnxuLwJ0DJWukK33U43PBExfixDfJs6STO77lrMKjgcVhZqzjUygonQccfXGcjvyTfaNVvPqmCV5rEdLwNbv6 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB9473.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6e2voy+EqzX8Ga2kAACPDTGOGiN6AQhVuELsOcKkQScrWxHavum6yRB+r7+nZM6wdIWBgGLWziij00T4soCJxXtyOS6vPq1cEhyJvbZ1W2ppHilrHqgAqwt7z+kEMsBfyRTFyOvkWCdBFsbwP8Pl07b/Etx8QiXSy6TAiFE38vUhVjh+EMbEKN5TpfgbFLNb3Fv+gYtTtk4ENcf8KOhJKU9g5Sg14hf3samnPSiSp3v0Q7lI62GzT+YjOLRuDWRiTuMSLPDEUGDFExaG3rFzFWNB+eSjBk56J2Q1sVaUFz5MIGZflkC2rYM+bIGWMKS6JGyXUx2TMYS4ThjMHRAoRt+S8J1Fdn7bxBrwtw/YNpFrp6m0Dbtwc+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YIpATHam8HPqgSMm+Vq4ty1F7blxkIn4alxYCKKkk7gyc9BOsxYOpx6it6Q/fwTezfWV7pREG9/RyAFPs0NgWaN41Z6JbscfWfSug9r3l5Dm/lxny3HH18rKcDB1wWD8MJIf1+BhT/sXYt X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 119351f5-9689-44fd-4f4e-08dd2e72ee4e X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2025 16:55:31.6621 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 47Ev82kxyOY3AqI7Twpg85W6AXcd8ZTxLEGWP62szpimCOCEINOrFx9E8A2Wv9yL X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6634 X-Stat-Signature: wd1dxqg9w3wexz8t3iood6bm7mthurtg X-Rspam-User: X-Rspamd-Queue-Id: B4E42100006 X-Rspamd-Server: rspam08 X-HE-Tag: 1736182661-150962 X-HE-Meta: U2FsdGVkX1/PheE6nquWlvGZ/jqnAFasNB20bDvNdP+DrGzBEpZr/RsWntXRhgyjIiDGJS4+deDHC/wrLctSclmraC3aZ8KgmHhOgtup8BwFwIevYNZUBJQXYd77UL7QtGwqq+6dK7faRt7gs6nktlILJxbzU4UFnR/L9KO+hEXcn4pBXHGMO5RVtYQooSwyO8Y2aNCgem+RNGmZvwj6L8k/u17rxZ+SZN8OkwXZbR7ITXTM15e56h1qtufuySYW5qw0lvA1Ji0MbEIqRbytdiFj4gYfy62CDvj7YHUOkppXXxO+WhYgb6a0h3c75V83amINiV36BUgVZ+F+LLe+8OfBMtQ8cAmXhfOOSi8KmLFBgHyiIjPXDMR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owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This allows to test folio_split() by specifying an additional in folio page offset parameter to split_huge_page debugfs interface. Signed-off-by: Zi Yan --- mm/huge_memory.c | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index ec27287b7cbb..50f268741c4f 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -4125,7 +4125,8 @@ static inline bool vma_not_suitable_for_thp_split(struct vm_area_struct *vma) } static int split_huge_pages_pid(int pid, unsigned long vaddr_start, - unsigned long vaddr_end, unsigned int new_order) + unsigned long vaddr_end, unsigned int new_order, + long in_folio_offset) { int ret = 0; struct task_struct *task; @@ -4209,8 +4210,16 @@ static int split_huge_pages_pid(int pid, unsigned long vaddr_start, if (!folio_test_anon(folio) && folio->mapping != mapping) goto unlock; - if (!split_folio_to_order(folio, target_order)) - split++; + if (in_folio_offset < 0 || + in_folio_offset >= folio_nr_pages(folio)) { + if (!split_folio_to_order(folio, target_order)) + split++; + } else { + struct page *split_at = folio_page(folio, + in_folio_offset); + if (!folio_split(folio, target_order, split_at, NULL)) + split++; + } unlock: @@ -4233,7 +4242,8 @@ static int split_huge_pages_pid(int pid, unsigned long vaddr_start, } static int split_huge_pages_in_file(const char *file_path, pgoff_t off_start, - pgoff_t off_end, unsigned int new_order) + pgoff_t off_end, unsigned int new_order, + long in_folio_offset) { struct filename *file; struct file *candidate; @@ -4282,8 +4292,15 @@ static int split_huge_pages_in_file(const char *file_path, pgoff_t off_start, if (folio->mapping != mapping) goto unlock; - if (!split_folio_to_order(folio, target_order)) - split++; + if (in_folio_offset < 0 || in_folio_offset >= nr_pages) { + if (!split_folio_to_order(folio, target_order)) + split++; + } else { + struct page *split_at = folio_page(folio, + in_folio_offset); + if (!folio_split(folio, target_order, split_at, NULL)) + split++; + } unlock: folio_unlock(folio); @@ -4316,6 +4333,7 @@ static ssize_t split_huge_pages_write(struct file *file, const char __user *buf, int pid; unsigned long vaddr_start, vaddr_end; unsigned int new_order = 0; + long in_folio_offset = -1; ret = mutex_lock_interruptible(&split_debug_mutex); if (ret) @@ -4344,30 +4362,33 @@ static ssize_t split_huge_pages_write(struct file *file, const char __user *buf, goto out; } - ret = sscanf(tok_buf, "0x%lx,0x%lx,%d", &off_start, - &off_end, &new_order); - if (ret != 2 && ret != 3) { + ret = sscanf(tok_buf, "0x%lx,0x%lx,%d,%ld", &off_start, &off_end, + &new_order, &in_folio_offset); + if (ret != 2 && ret != 3 && ret != 4) { ret = -EINVAL; goto out; } - ret = split_huge_pages_in_file(file_path, off_start, off_end, new_order); + ret = split_huge_pages_in_file(file_path, off_start, off_end, + new_order, in_folio_offset); if (!ret) ret = input_len; goto out; } - ret = sscanf(input_buf, "%d,0x%lx,0x%lx,%d", &pid, &vaddr_start, &vaddr_end, &new_order); + ret = sscanf(input_buf, "%d,0x%lx,0x%lx,%d,%ld", &pid, &vaddr_start, + &vaddr_end, &new_order, &in_folio_offset); if (ret == 1 && pid == 1) { split_huge_pages_all(); ret = strlen(input_buf); goto out; - } else if (ret != 3 && ret != 4) { + } else if (ret != 3 && ret != 4 && ret != 5) { ret = -EINVAL; goto out; } - ret = split_huge_pages_pid(pid, vaddr_start, vaddr_end, new_order); + ret = split_huge_pages_pid(pid, vaddr_start, vaddr_end, new_order, + in_folio_offset); if (!ret) ret = strlen(input_buf); out: