From patchwork Thu Mar 7 18:18:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13586113 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 14636C54798 for ; Thu, 7 Mar 2024 18:20:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 966826B0258; Thu, 7 Mar 2024 13:20:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 922806B0259; Thu, 7 Mar 2024 13:20:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7DEA16B025A; Thu, 7 Mar 2024 13:20:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6EC006B0258 for ; Thu, 7 Mar 2024 13:20:32 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3E9FB4122B for ; Thu, 7 Mar 2024 18:20:32 +0000 (UTC) X-FDA: 81871058304.24.AE0FDB9 Received: from wfhigh3-smtp.messagingengine.com (wfhigh3-smtp.messagingengine.com [64.147.123.154]) by imf15.hostedemail.com (Postfix) with ESMTP id 31BDAA0011 for ; Thu, 7 Mar 2024 18:20:28 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b="D vgTWnp"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=HhyYVyOK; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf15.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.154 as permitted sender) smtp.mailfrom=zi.yan@sent.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709835629; h=from:from:sender:reply-to: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=arK+NBGKdHWZ6efyHQWXlXfgQ1L/CzF1zSO+BWgFZXQ=; b=zhMO1Tkn5zsQ9Ob6YfEg2Bc96zQkuxro3YqInUS+sxNrcc5wBg7lu3tBLFPmhYndI8KB39 GCP2tVBRbagj3U/ERaA78zNvVtX+9GnfoJf6NSkBXGdLXnp+IZLcNXnX02Geq4NH/VHCbt YEcxPiOL8k+JZAUkG8tt4w28TLSpC1w= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b="D vgTWnp"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=HhyYVyOK; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf15.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.154 as permitted sender) smtp.mailfrom=zi.yan@sent.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709835629; a=rsa-sha256; cv=none; b=Rp9/okCuoR19JdMrKAmgTxki3omX7IarlPRyCozjChrQjDnEuwszInWjvXzd0ok587XDa8 8xuYwkPj5WwjNhHDu9Fj5o0tqetYLb9Fw3KdjPkSnvr96xaGkEvkdkxuLWMKIZZbmdvPRs 40GIMkfv7+uCUwwQu8WnphKpmBCXL2Q= Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.west.internal (Postfix) with ESMTP id A0CBA18000CA; Thu, 7 Mar 2024 13:20:26 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 07 Mar 2024 13:20:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :reply-to:subject:subject:to:to; s=fm1; t=1709835626; x= 1709922026; bh=arK+NBGKdHWZ6efyHQWXlXfgQ1L/CzF1zSO+BWgFZXQ=; b=D vgTWnpExQF81NowzJzUTgnd9lYg2Yxvqc1NFwSGjL4AdA/ycBpKzffa/5eluXgj7 eGl2AI8DFJLCb9n+kKOPGQs6CmonlhWsXWHJG82SQSoCtPIz5oWbhopO04OPw2La AEq39UGxN4q/bkS6UPbKCu3C/EPrGyiBC9rlJ6iT3JL+7K63cyKYElGPm61RNxRy RqBkKANLzyKDZU+OsOC64aYA4tmbSo9UaNa8uqpA0mLHaFATy9e/OgdAhHtRvXJ2 k7AJ5Bn8uVgKQmdr2tFqIIfnDEW0eIK2XN/SGjnlVoJVDf/My0t6V8FEYV1yDaZf 3UDt9B5WFLG1KcxFYSV9w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:reply-to :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1709835626; x=1709922026; bh=a rK+NBGKdHWZ6efyHQWXlXfgQ1L/CzF1zSO+BWgFZXQ=; b=HhyYVyOKsumEySrPt Hqr9GLVr2KX7esjQZZTMMsuPDt9AmLAKtHvXNIhBjS9nMlkq/kyRKIlRGAJUnhnE vQ54uiRxjCnMD4jfYENEPLSYRJvNB0R1OWDkG3Sjzz71vEXDIFCcifM6v1v2ETBI 6fYgQ1AriMBHhHAnL4Z/VgPKf0AVTKtp/3XBjdM5ZP7FC8ODc8QDXnhQ42qF/xx/ 1DbTftHtGOiZzALLeRcWP9TbKN4/to4sJdG0QK38MCxUTZJa/ypoG+D8qGKGFRow Wp0K01SALTlNQ8fZixzm/s12GIzH6MkpKfGgn0OqHh/n19WkwnWWFk7huL4ZogEB yFQgg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrieefgdduudduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofhrgggtgfesthekredtredtjeenucfhrhhomhepkghiucgj rghnuceoiihirdihrghnsehsvghnthdrtghomheqnecuggftrfgrthhtvghrnhepteduve ehteehheeiteeihfejveejledtgfdvieeuiedutefftdevtdfhteevtdffnecuffhomhgr ihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpeiiihdrhigrnhesshgvnhhtrdgtohhm X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 7 Mar 2024 13:20:25 -0500 (EST) From: Zi Yan To: Andrew Morton , linux-mm@kvack.org Cc: Zi Yan , Dan Carpenter , "Pankaj Raghav (Samsung)" , "Matthew Wilcox (Oracle)" , David Hildenbrand , Yang Shi , Yu Zhao , "Kirill A . Shutemov" , Ryan Roberts , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] mm/huge_memory: check new folio order when split a folio Date: Thu, 7 Mar 2024 13:18:53 -0500 Message-ID: <20240307181854.138928-1-zi.yan@sent.com> X-Mailer: git-send-email 2.43.0 Reply-To: Zi Yan MIME-Version: 1.0 X-Rspamd-Queue-Id: 31BDAA0011 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: ipsw6k4ry3x6nikanugqfdwtzpj17187 X-HE-Tag: 1709835628-225209 X-HE-Meta: U2FsdGVkX1/PwSoFmXPWp0zxysmEMlCbF0QDlZOQla7VaE7Gxbex5I1RqXzgejV1qowho2xEECWRwMGHszarY7aM+MA3feK3UvZRrTZzuJ52WnwqlNDML+2IbwRApdJRHEmIKc5Il+gC7d7xzwKhvVrBa2Rc/wINn5Wf8RU7Gph5Zzu1x8bUjqrrSXH8L6DTYvANIWMx396K0Xt12pjZr2tSCbyOFjUHplvVjxsMLYr92LHxeOdp1aJgCkKCGzTLGdpZPsV2tKBVn89ekQBx86w0hj6tWgjMuqvaVFgYv0FVDmExDkjCZpNQOV4dR37wv5KPFtTPuxkzcVRb+/ITFzGREoN0dz8/BgJupQA3X8oy7uqgvzIFFItBEsW59sQQcvOKyK3owCPBETiliAE1nemhWjkjJzy+GWTEyriPlAcxvJTVn/cOEA4xYYgIOCJ2gZ/xcMpUwWqJImmPe16e605Qc24XMkn+3qENP2Av44EVtyDbbmYZGKD/uaimTLbuXlTcXCVbY3uodRYBQVCGorIqQ7GlRJI4YFWLC17AfGdmccHgyZGguwMlnT7PHZyKoBAC/Kr7uUyxak/kdxn3wtROHmwe7ku2vN2eWI4vGLZtoXvU/wLEQRluowO0khGSIwIVvfQKGM3Yiy3wI0Iol+vdkMJPRyR7nBMtQZkCabDg2R+gf8xaYvotb6nv6IK+kiY5PeZsibB5lwQF/JhztRbgdKPa4nJKfqI2KAmHj2b+0/ojFZUaM5G5o/C1iw38fANLTgwSZZSUnrNMeJjY/lmGmxeNP42kqPnIyZeWnQaklD2BGudWVdtuxpqaKVv3h0C7OFcgJMOs/NIEhvk8P3aVQby+jxa52AOFi/c+xcmEfK7rQM/gXO+nPqMNTg3S+DmFER+yVtVSfj4GVU8mEOaOdPKs1Day8Xz13PinTdpq3RuVZ48yzl9oinXwygXBjLYGJWT33Dj/l+MZodE Dp6J1BQv yIz13EBHgy3v+1trOY6yBG0BcOfjbZhUsxQz8nK9wnUNEHLwFzYAETUbYQKK+wqzgNo+uE29RUE+1knvNqQWZuBIGx4Gutl/0zZgy7GLnxDmB8lU0pkw2Yt9JGd6hsms8QhxtTZfyZ8tdWWC2YMRjrHYPAWi/lY34MroD 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: From: Zi Yan A folio can only be split into lower orders. Check new_order to make sure it is smaller than input folio order. Link: https://lore.kernel.org/linux-mm/7dda9283-b437-4cf8-ab0d-83c330deb9c0@moroto.mountain/ Fixes: c010d47f107f ("mm: thp: split huge page to any lower order pages") Signed-off-by: Zi Yan --- mm/huge_memory.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index a81a09236c16..57fca7bffd20 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3052,6 +3052,9 @@ int split_huge_page_to_list_to_order(struct page *page, struct list_head *list, VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); VM_BUG_ON_FOLIO(!folio_test_large(folio), folio); + if (new_order >= folio_order(folio)) + return -EINVAL; + /* Cannot split anonymous THP to order-1 */ if (new_order == 1 && folio_test_anon(folio)) { VM_WARN_ONCE(1, "Cannot split to order-1 folio"); From patchwork Thu Mar 7 18:18:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13586114 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 D85BCC54E4A for ; Thu, 7 Mar 2024 18:20:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C1BF6B0259; Thu, 7 Mar 2024 13:20:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 547246B025B; Thu, 7 Mar 2024 13:20:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C05C6B025C; Thu, 7 Mar 2024 13:20:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2E6536B0259 for ; Thu, 7 Mar 2024 13:20:34 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CC3A6C0C07 for ; Thu, 7 Mar 2024 18:20:33 +0000 (UTC) X-FDA: 81871058346.12.34FDACC Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by imf24.hostedemail.com (Postfix) with ESMTP id 8864F180028 for ; Thu, 7 Mar 2024 18:20:31 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b="ibb/EWQQ"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b="e5s/BHxf"; spf=pass (imf24.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.25 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709835631; h=from:from:sender:reply-to: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=Bzn2/HzPoneEzIl1irDBBJLijK1Oy0SB9DI4n9G42+Y=; b=qyv4WjZqZDCeeIwZTAxcaZtoMJyuiF6hR/psOexYPpYLGojzU/zqfhwdBh1SAoayysjDG8 /qIiwJn2hUz63WSQiJUHTHnGNU6Y46Q4QO6XNOFkZ8asLGFqPFKYP+5zOYXb4DcX7bxN61 3USu0SThRbOF094NVX9U8bW4FGiTZl4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709835631; a=rsa-sha256; cv=none; b=gWLdipYgwEnl09HIsI2kX9FphHK452fRLqSjqEz16moqgTJY7/VsNHdGC3lR1viQkxiuuE K4t3t2ENL3Lsg0x9smZ6rq9aNPhUZPshohJR0duOHq/sbtNvsCIFIO0CEy1N43Yw7eAIfs ad0eNexy3yHsm8RoLU49OQgI3JpAMtU= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b="ibb/EWQQ"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b="e5s/BHxf"; spf=pass (imf24.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.25 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 1C5743200319; Thu, 7 Mar 2024 13:20:29 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 07 Mar 2024 13:20:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:reply-to:subject:subject:to:to; s=fm1; t= 1709835628; x=1709922028; bh=Bzn2/HzPoneEzIl1irDBBJLijK1Oy0SB9DI 4n9G42+Y=; b=ibb/EWQQhLxTZOSpDi4pGqyLnOsBGSO6hMrqx9bkeyTLNT+mIe4 hMm7msjhD5zh3dkM1dzTsiUuiBNw01j+0CntWimywpNLGE9TvaEI6KWmZQU6PctD 6F1ypPcUp6bUsTCYeNFIjdhNGleUwlwbGHTZNagBVHqhPYun0d5yI/R6pmrNgzTb f/SioJNNGNg4So5tZffWJCFAH8vJy2VIrxIdejVe2LxspFC9Kv3lzEBljTjxyGOi 1BTnX+ABz1OlleBN+uNfhiQrwWCNf1oykj5QYWKvJHJBtKYWXSd1sobvhkX/GkfS nhckEHMjOaNzNYZFw+7XBj/DSXVE1+LjyCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1709835628; x=1709922028; bh=Bzn2/HzPoneEzIl1irDBBJLijK1Oy0SB9DI 4n9G42+Y=; b=e5s/BHxf7qUOEHEosBWBlYKgqSQWZDXP8+wtrwv81GGqXmPB3hA EIHYZp/HxRbpNHAUlVONkGj6IIuX8/MSp8dv7aKb/SR3xR7zY+tUA8NZnhlSLcI2 mUwqsmxzd9Vc9w+ehKwBZnX2Arj9uApvebvjZnDcaxDR+Y0ul/9V2CxjTM94yUqc Zwmi2vd9mT6VR+J/5Ug26K0LfqMZo/G9WLDBhztsrr7KZ+oPEvuXJGxGD8I+Ou1S CMOQQX3qDl+FdV63rVNqzmwC1WBhiO9t+L4xc8XoK9coEmaiXdXdsfHMM5VNfida EsbPrOSGgqklOtGcBUG++Vwt3XB/Z35VkFQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrieefgdduudduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhhrgggtgfesthekredtredtjeenucfhrhhomhepkghi ucgjrghnuceoiihirdihrghnsehsvghnthdrtghomheqnecuggftrfgrthhtvghrnhepte dtkeejffekjedulefhueetkeeijeeiheejfedvfeeihfetveegjeehgeekgffgnecuffho mhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpeiiihdrhigrnhesshgvnhhtrdgtohhm X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 7 Mar 2024 13:20:27 -0500 (EST) From: Zi Yan To: Andrew Morton , linux-mm@kvack.org Cc: Zi Yan , Dan Carpenter , "Pankaj Raghav (Samsung)" , "Matthew Wilcox (Oracle)" , David Hildenbrand , Yang Shi , Yu Zhao , "Kirill A . Shutemov" , Ryan Roberts , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] mm/huge_memory: skip invalid debugfs new_order input for folio split Date: Thu, 7 Mar 2024 13:18:54 -0500 Message-ID: <20240307181854.138928-2-zi.yan@sent.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240307181854.138928-1-zi.yan@sent.com> References: <20240307181854.138928-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 X-Rspamd-Queue-Id: 8864F180028 X-Rspam-User: X-Stat-Signature: gbgy81e4yoqw9w968ebskest75nhtpfk X-Rspamd-Server: rspam03 X-HE-Tag: 1709835631-342629 X-HE-Meta: U2FsdGVkX1/TkwZgK9XaxYSy0uI3qyEdH3LLFbcMO86wZzF1VMCt2RU8kx6G1ojUjqiISP/kfYuvDDgFFcEpXTkrd38vWGH+rJnpOWaiFi2bYTgXieeZnmwc896qNrZy1TlEve2+V7nnebkle5CfMNo/Ht79LSwWJeUtB1PJ2zm19EDAOF0QBgNGuwlIBEK/C3lXRixo0fvgP+Q+Z5L4h+9RCH8za0DZIC29TpR08/OLIfwyI+odzIaEsOkp4QCelSLQZ3bhBaw11TmV9Uls8aZ738N5yte6JiChrjwKn93aSFtm4V0QYKT0fRnH8Y5oJHR7n3PjUOQgeu5yGK16+hieWHi5LvRNyhAutX6LQe4NXxO7i5hDZ9kDfsoMjAxSeWSC4/shwlFgfN3W/deRHe7mrQNGxEZ8NTSS9hHIlnKwxHphRfirxXXDsRaF79RlKN3NffvD7yk2L/++j+nzd1ujqK7sl7jIFeflzLUK6kvfm/pfaaRVQLW00/qppuSR6RIoDmmfzLdFhH2487oFK8HArGe0NP0jtl9K8onwDxYBnFYgpFufw7iF0NaRhbQUU0cV1tvlMpKUsrMeYzN5MbFSl5SMcrNUT8uMTnNZlv5FL6dTf+vP/mknwel1cTA2wY/NzABo84/IBY38bviK/dqndhu2gf7wrMbhb5PMPz37IgwFR0CQiFb1I1udL7oT2+MOySO6ONcSkn3BK6z3pssf3d6HM8EtxdYtGKx8FDAovnI1aO+P3tYk9kqDfLOeFvUzDBSfIo15yZqPyjJZXFT3HOhyMmSfqNHFKJ2XyHob6id1g5tB7HJNoaMnaDb7Mkm+rw+75Vd9d2Tx8wsK+JIG4FCfMMJnvpLRQ4Fm3DcYBT1VBW9yLGH7HEuvC/I/gZ3S7R1ETy3MlQqgOqkWCL5E3ykoXRyhVwF/op9f1nLJJPeqvWmAOJUi9oRibMCghD4MlFlZ/V55UExM1Uo x7lO2BKq gaNBdHeFNKq5E31poRtMEz6x8kpGN4se4m76LlV7UQzwWGpUm2MW21zEa8u1O1M1Q+2dfROuALmz4Enr41v2un1AURTWvq+gzPNSBYrcWWxvzxK6M5fKZtBxp/VX2m1XeDlYvAMwKZ2MkdxdiJ05mA9tQBnDnLcwsntH1fWCbzMUD/sXDSHfMG4c3K40JImMK9UewdSbCDTx1PE/J+de6eTFMr76oALjS1tmXTep2F7IBaMf0zZlLTgmZS6C8hbcVpbx+LPhc02bAUW6HNY+btLOpBhaBuIaUM9vnQOU/G3AqztuEcsZKvEUm1IAWKCh0HbR474druJ4XODIdUivBPI8l9Mkc2J3IBlrMpEjYmgWkvnnHC+Opwf3B33IxJmFTzsjlbd+yQu5XwlLqP8golCcgGP5NpEGjlsHvj418gg56SLxibMOcj217h5iwOD04r6xQeYmw9vctvdSi0yQXpa1Fj7VqsO4rSfL7YAdLT86Ajrn8q2E3tmz2yjEO4IBwtRj9SGxeIhQ5vQ6tw7wugLCSkMaoK9RZCLKyrgtqSFHqcKMt/aUQmJ+CsA== 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: From: Zi Yan User can put arbitrary new_order via debugfs for folio split test. Although new_order check is added to split_huge_page_to_list_order() in the prior commit, these two additional checks can avoid unnecessary folio locking and split_folio_to_order() calls. Link: https://lore.kernel.org/linux-mm/7dda9283-b437-4cf8-ab0d-83c330deb9c0@moroto.mountain/ Signed-off-by: Zi Yan --- mm/huge_memory.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 57fca7bffd20..9859aa4f7553 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3486,6 +3486,9 @@ static int split_huge_pages_pid(int pid, unsigned long vaddr_start, if (!is_transparent_hugepage(folio)) goto next; + if (new_order >= folio_order(folio)) + goto next; + total++; /* * For folios with private, split_huge_page_to_list_to_order() @@ -3553,6 +3556,9 @@ static int split_huge_pages_in_file(const char *file_path, pgoff_t off_start, total++; nr_pages = folio_nr_pages(folio); + if (new_order >= folio_order(folio)) + goto next; + if (!folio_trylock(folio)) goto next;