From patchwork Thu Dec 5 00:18:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13894606 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 8C596E7716F for ; Thu, 5 Dec 2024 00:19:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1CBA66B0099; Wed, 4 Dec 2024 19:19:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 17C356B009A; Wed, 4 Dec 2024 19:19:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F377B6B009B; Wed, 4 Dec 2024 19:19:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D6F9B6B0099 for ; Wed, 4 Dec 2024 19:19:35 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 937631A0EE7 for ; Thu, 5 Dec 2024 00:19:35 +0000 (UTC) X-FDA: 82858996122.06.AAD2ADE Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2078.outbound.protection.outlook.com [40.107.237.78]) by imf19.hostedemail.com (Postfix) with ESMTP id 8C50F1A0002 for ; Thu, 5 Dec 2024 00:19:16 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="E2/RxZYn"; spf=pass (imf19.hostedemail.com: domain of ziy@nvidia.com designates 40.107.237.78 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.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=1733357965; 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=Bxq/htjbbRs6vBjKE+Rb2qk9i5PlZjDkb7fkaknEWEQ=; b=ov2dsO5DWUm7mKbzfJwLj3h3ddTlDnhZ373N+rA8C1Orh/wXXVtQytmV0muuGQNi/ueBTA cfSq0X5MIOvSZjsfAvRBKDC8naJgu3Fnd5U1R+lHNSGhvl7cFoe46H6Yx6fBe8tkf7EdrV aAMT0Iit9uVxU/5sxv2NzNvUkIHjv1w= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1733357965; a=rsa-sha256; cv=pass; b=q0ADFQ0CkLZip56sLUQtYNYlGCwoEHRl9vyuOTNpmfWuebeszAav5DX7acl1dViPLTR15q 1TKhGOeOOW52qs0NHUJV3XVgkOwB7P6bwruHrIWXrEebpo9AA29S9dxElYLGrvN3iVBqiw tieBkjoIh3kEb9agwQ+8nuO+OSTFStU= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="E2/RxZYn"; spf=pass (imf19.hostedemail.com: domain of ziy@nvidia.com designates 40.107.237.78 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=W+OVIbXjN5L2B/bHf0jy5nPenVtZ/uhnGuTCSpELjN93oQsf88LK/ePL2iH/nlUMpEzE0N06HYbnIv3ZGnQS8IvckPo60nlDgnLA9C60vCzJ3FpWN3HB4znRNYv9EmQNr3xjzGxMoz4c4W63Pcq9qLTgQrOCMXLo7fQAMLVo2Kr+7jMRjd19augOLW+NIoy9S11zZc+xxzIknkFy2BgYUf9bsCQobU6hD2Z7P/02PV8yNauBPEaA+7zALVsuAQsWN0HfXya8Wp1AAQLtsHlzjo4hTk5Z9qvHEnCcVd0utIfdkqw77IOXWhdVpb9yms3WEwE+wp5X4kEqh6W6Kpi6BA== 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=Bxq/htjbbRs6vBjKE+Rb2qk9i5PlZjDkb7fkaknEWEQ=; b=pfiFbjnrkmSF16wPMDJRtEeez6Budke2f9L1ceH2u2YIlzOksgKxSPgJhJsmL19/X1a82hdTCXqc6DeMFTN0Fiw1ZZkLqg9DW6wnyTCf26/ivHOdPsk8cYUt5HUr9un/Aa8gAjLx2okSaHk8viDnSwOkJQFXkZ0v0/uk0q2rpLDU/U834hWeoBlB2dVKDFKutG1x5kYspaZxx+Iu9mTn6dNJFQEle3LeQBl9f138gf0oj+BrtRdj0w4stle1Gl+TO5O4aMAHLKsP2qjJGTSpVgOjjAkxDiJqjrI5eykjukES0vbmbrLmUjKP+jiPbqTGgECKGoTm/moI1JXEsDIzrg== 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=Bxq/htjbbRs6vBjKE+Rb2qk9i5PlZjDkb7fkaknEWEQ=; b=E2/RxZYnr3DdEs6tTLW8ENyOYHzHY4aC6taZRHsd+MMxUFWfQYnMPvUf1tjiV85Kba4W8x1ITiX7EmTWZxwiksJxL0uwczhR8V6DqolhTh5rkIRB6yLih7UTF2zOdHhunYGcN9g/aBQsYM4sT1L8hNsGOsiGW8lBJAVo18kMrWlI5sGyZtMKFro51pfNX0A6nC/DEh22KJqnqWgGxeUE4VA41Upb23Sq7BsnPff+M9/V72BS5Ttd2CgMnWcAo7a8VzYwUOnG/XN7g1wb3yHUlckC9A++GTfB+Yhm3HidB27tYjK7iPar9cPsCYpbnhOMnuFB4KDfyVyC+6zpWmjJZw== Received: from BL4PR12MB9478.namprd12.prod.outlook.com (2603:10b6:208:58e::9) by IA1PR12MB7589.namprd12.prod.outlook.com (2603:10b6:208:42b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.12; Thu, 5 Dec 2024 00:18:48 +0000 Received: from BL4PR12MB9478.namprd12.prod.outlook.com ([fe80::b90:212f:996:6eb9]) by BL4PR12MB9478.namprd12.prod.outlook.com ([fe80::b90:212f:996:6eb9%6]) with mapi id 15.20.8230.010; Thu, 5 Dec 2024 00:18:48 +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 RESEND v3 5/9] mm/huge_memory: add folio_split() to debugfs testing interface. Date: Wed, 4 Dec 2024 19:18:35 -0500 Message-ID: <20241205001839.2582020-6-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241205001839.2582020-1-ziy@nvidia.com> References: <20241205001839.2582020-1-ziy@nvidia.com> X-ClientProxiedBy: BN0PR04CA0072.namprd04.prod.outlook.com (2603:10b6:408:ea::17) To BL4PR12MB9478.namprd12.prod.outlook.com (2603:10b6:208:58e::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL4PR12MB9478:EE_|IA1PR12MB7589:EE_ X-MS-Office365-Filtering-Correlation-Id: f75e2074-40a4-497c-f60d-08dd14c263df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024; X-Microsoft-Antispam-Message-Info: dcvr9gTrsRvR8Rij58+lK1ZYcmV8TaKNXdV6yIYjmS6XwEV/FDNyGtHxiabF52exnnBFygtP+t0K9oSfLaDMmI+izkci0lR2wsQzvj3JvEkYD7AROZPw51M19e/wwfg79+eXwhhrxZj8f2sTZ/8F8uTqtoVX5yEqyLXI9eb5isknKp280CwqOAQOJkjs1Yb+a4dwfIL5nt4zUKp/UpuHdMY5hXGe2wMle9bcgc/J2sbVGiQuxLUYP9bGAXrOLT2herAmsW83fxf8qjDQn+uhauPuqgQ4Qi1yM0W1GOOSAqNhwl4EpztRJ6cHfpOYO13GgKPVwrtZO2imiPYgklNfLt7Yr1+1JaB9gTuVNlZzNDEFn8MQ61JDKLvaU1BpLYF9vMlWVZsNjZhJ0ibDgLjd8Etbr24GBLlEfNCuNpvOVOs0g77MgCACsk34GEZn/P84z+VM1xW2Kbd+K/+WEZ249IeJ2MQq4oTzKLlFFuPt+n2x+DGgVXXc7dhSIukda3SvM83jzACksOkAvvPWOS4TpEsEaisTOxfxZOdqW9CbjMIIDyg1jBKPZmSbBD3Hr9xNFj+jLVJNv8++VU3Lwy5fc9g3FSQxdrGqUu7IhLoF9XOuDx7uJrHrE5w1QCfOMbrCdNM0m0A+qtLE753BhBEAVhE0fEYOSAQSwk2eNuFNDMB4ZZN0y6XHXBiUAkd3FgOz6j569uox8ZRQvYamV3sL5as3yX7oMWKj5u08KuKuBa1o3LRx6tbhcLcpxyM0rqJOzPFPWSzUu2hjHT2zPJ1ypkb9ZnaHsc40w7ocelicWWZ54IBEu4U5ORXyMha7AWR3FASVYR/pJHCyu6d8MVyKAMIr4O0bfJcgBsPQW+IP7Vx7i2Kit/2X8K5/cJCQlVchcDuiNeQYtO/TI3tYYvGmQmFHuQnrI7kWuEGoLn62DfIH5sdr+mFuOyH8r4YWpiJ+rR6WrLfmC8FaeQPHeWczS/UZxeP+tBH+5CBp1G1jJjsGR2Rwla4bIao84fPeFgfiWCk0mc/qeaYqg4hQEnfx9I3+YcT8fuiIzMsyL20SmIsZz1m+GsX6/g123FHEKMvt1c4IZ5g4v4VqhTMmMWBJ9LkCeu2BlxrRGeb46cZnnBbh3JsIyxILTWDhsxRtbjpXJKsSQqB0d2iAa/3yezrydrKmUjeMc1s2ewBdma2iYOl3TmIq57GJ5OghSOKhZ4XEaYIQPowI4ODJREquCb1tWtffniivQqIOacVLsCZKMtA/Y0qmjg5CzLRMPD+7/r04x+GR/IjV9J+VTh2F0/xF9+Di9qnh7+C5EmxIFC8kO/ZRd6L3bwl5J4cSnSwMdFBUTXOUHSfWD8nkZAfvdu1Z7A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL4PR12MB9478.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(7416014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R0URncAtiweNE7zq9b3E1L/MfmkLFw1u9uethL3oypOuHJxqKYmlAD9ysYGaBqZSbpvS2+o0Ip6aWSkYw3pOKmtyoDskRf6N9Q5iIYgGwe2wfmxaeURf+wmrIseSBFEIJ+DmKD4KDUWdQqaVJyHPH/blNbHs8J+CeXbB5y2QpqUkhFRKRfRhlbw+U6sXZLzJe/Y2VOYn1cvywMnsploFwAHrs3vJII15IvZxU7YEI4r7s9XW/oCAs9s4iwLx7/rtwqjD8W/GXsd2P3SRfdNnki3MJvdWgAQXas48KUdC3b9Q1dsj6nsSlWvgBYpxKzyw3qG58UPLMKw3n+NqTTZpfPVdH7K5dKykbI4Lyii3JLg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5uyYWaXw9YM3ZvMA+7Etca3efcAq7FlU7ufzjK5QA1FxC2+V+pa/lSbg/IA845od+yvYSwU5dx3med+Vuu4WHU7YkalNi0DvJjFOqiBoLWnQgM1VE9QP3Dp8oT7BWt3OPfAmBkfzbxb/NlmH X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f75e2074-40a4-497c-f60d-08dd14c263df X-MS-Exchange-CrossTenant-AuthSource: BL4PR12MB9478.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2024 00:18:48.9246 (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: 3U7wsB7U+JW9ht2kVHgKFmwX1CR+PitJ3DJ7sFHid+yn9Vl+6kNy9yNmhu8jZl6j X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7589 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 8C50F1A0002 X-Stat-Signature: 44qug654c4wejzj1fc98yebatt3xczm8 X-Rspam-User: X-HE-Tag: 1733357956-486769 X-HE-Meta: U2FsdGVkX18UTBawd2h5oBUGLl3oOPIpj6cE6Q5HiVPUc6mJfk/jhBkY/mGCOoEgpqb9P3+k06aAd/P1Kxaau9xzW1qZ5aU7vQIo74v41tbc0ZCiXByXV0OryieXl4KiaDIIht3fDOVS4CkDDnegmWDjube0Bfz8CL5VB6UkFUrUo0pdU/WY9gqXkltsBj5vZMmNGdKwY2sv4GR8owb2Cnwt/G5vUFE5rOU0IqUa4Uy3p1jmECDA9We39emn6PZqs+AFhTZ8p0QHLSLeVTu2f8pbtmyH3+fyTlJZEdf2so9CJNSCLOGHXW/wwuapRY6oxQkrsXUvkh2Al9h+s1B6n1jk2kZZSo7AQIVvmF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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: 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 | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index eed4ff97e235..d6ee18327cae 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -4141,7 +4141,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; @@ -4225,8 +4226,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: @@ -4249,7 +4258,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; @@ -4298,8 +4308,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); @@ -4332,6 +4349,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) @@ -4360,29 +4378,33 @@ static ssize_t split_huge_pages_write(struct file *file, const char __user *buf, goto out; } - ret = sscanf(buf, "0x%lx,0x%lx,%d", &off_start, &off_end, &new_order); - if (ret != 2 && ret != 3) { + ret = sscanf(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: