Message ID | 20250108233128.14484-12-npache@redhat.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 0AC66E77199 for <linux-mm@archiver.kernel.org>; Wed, 8 Jan 2025 23:34:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D14A6B00A3; Wed, 8 Jan 2025 18:34:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 87F506B00A4; Wed, 8 Jan 2025 18:34:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 720186B00A5; Wed, 8 Jan 2025 18:34:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 51F096B00A3 for <linux-mm@kvack.org>; Wed, 8 Jan 2025 18:34:41 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0F95E1C7458 for <linux-mm@kvack.org>; Wed, 8 Jan 2025 23:34:41 +0000 (UTC) X-FDA: 82985891562.23.2416B89 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 5004B100002 for <linux-mm@kvack.org>; Wed, 8 Jan 2025 23:34:39 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fIg8lGcU; spf=pass (imf05.hostedemail.com: domain of npache@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=npache@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736379279; a=rsa-sha256; cv=none; b=35jUJJ0K+86pNY2HHKWFA9tOUvvVame2w3c/uncWzDsyKpfOm1YTrrTmp08+t8g+Wy6Hwz UCBQ2NfKkdH9YcfLGm914yPMVRqjKI514/A32Hjf+xh1cdwyUznjrZMiiinbts72UdvOZl KpshdaqSRDvsHo145Vrl+SZjYkI5TUE= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fIg8lGcU; spf=pass (imf05.hostedemail.com: domain of npache@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=npache@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736379279; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Dlo40r5jZ4R+FC4eYe0RwrYQN6FD9g5gDaMstpJqM5E=; b=ve1ksg6fxXWOmwr0nFL3Y9neDCRmYaMf9kTsiVFqDv1Skkv37ZcTqs+syKMtW0HpHdmd9M 987t9BoyIZ10qw4hEcTqwdx79NKH7x9LpnaIKCdtKa7OXhkOF0UzrQ0tgvSNDw4/93wBa7 +r/6o+myxqAdk3kJsTWct7EP1lkLWZI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736379278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dlo40r5jZ4R+FC4eYe0RwrYQN6FD9g5gDaMstpJqM5E=; b=fIg8lGcU3me+W15oWKRz37FArSkznhX68Y0iOgRvdEvlSzkVSNxpcQw+icGMv8gPsbNcK8 RbQDG+PWznmPAJxd8pEjyvx7MwWa8XcHAKRCjfU1dBSyqhirjX2ooaS1wJf6DBzfaoL2Fe pOfIQhqk4tL7EtBbvY9TnR9aCmwN0fE= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-370-l4fI3HlEPWGMA1brAjZ3eA-1; Wed, 08 Jan 2025 18:34:35 -0500 X-MC-Unique: l4fI3HlEPWGMA1brAjZ3eA-1 X-Mimecast-MFC-AGG-ID: l4fI3HlEPWGMA1brAjZ3eA Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C8D1219560B0; Wed, 8 Jan 2025 23:34:30 +0000 (UTC) Received: from h1.redhat.com (unknown [10.22.80.41]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4D5FE19560AE; Wed, 8 Jan 2025 23:34:23 +0000 (UTC) From: Nico Pache <npache@redhat.com> To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: ryan.roberts@arm.com, anshuman.khandual@arm.com, catalin.marinas@arm.com, cl@gentwo.org, vbabka@suse.cz, mhocko@suse.com, apopple@nvidia.com, dave.hansen@linux.intel.com, will@kernel.org, baohua@kernel.org, jack@suse.cz, srivatsa@csail.mit.edu, haowenchao22@gmail.com, hughd@google.com, aneesh.kumar@kernel.org, yang@os.amperecomputing.com, peterx@redhat.com, ioworker0@gmail.com, wangkefeng.wang@huawei.com, ziy@nvidia.com, jglisse@google.com, surenb@google.com, vishal.moola@gmail.com, zokeefe@google.com, zhengqi.arch@bytedance.com, jhubbard@nvidia.com, 21cnbao@gmail.com, willy@infradead.org, kirill.shutemov@linux.intel.com, david@redhat.com, aarcange@redhat.com, raquini@redhat.com, dev.jain@arm.com, sunnanyong@huawei.com, usamaarif642@gmail.com, audra@redhat.com, akpm@linux-foundation.org Subject: [RFC 11/11] khugepaged: skip collapsing mTHP to smaller orders Date: Wed, 8 Jan 2025 16:31:27 -0700 Message-ID: <20250108233128.14484-12-npache@redhat.com> In-Reply-To: <20250108233128.14484-1-npache@redhat.com> References: <20250108233128.14484-1-npache@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Rspamd-Queue-Id: 5004B100002 X-Stat-Signature: cw6chudt7mncjpwbdwkhm5cxr8ztry1r X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1736379279-905798 X-HE-Meta: U2FsdGVkX18KrMy6ZQWUUyIp/lbjtI96EB4AOQaCLg1qtPHQJPq4OGFY3qO6wLGmhwXBCeBequapWSP/c3x0r6d13HKGpVyGCQp2XdQg4dNjMb2m10V/rP2gYh1JsP6ftYMCIAgnl40Kp5iFl1OXGA6zOFTHrvUq1nbubO61LF8WQK1B8/nhcEmw5sYK6FtKWdb+dMCQNwav4temhIBoCCx89jpTcdUhJ143Hkr7Jqn102btkz1zG0X7XuSaCOzlzSjxo524YdVQlJgTq/gPHKoC6axNJoaQNSilapZWXzeJBGQDFNUY60r3YIktdF0xjK0M89O0XN5lKXpork2RGlFrGLY1tP+tbjOG4TMhd39cJZvGsSD4o30PiCfO2ixKS6XsTHQxFuFOc1A+Sb79iqeZXm2iuElfKNIhWFCi79dcvyVYZ2jVW80HJK0bGiMUiu4hxRw97xDNnqKE5TaI0DjKJRuh5nMJqGjv2GSzyHLR4ELFUDHX1PIGEbJ1IwVJS33JSEJICKY5WXu+eudF4+Q+B7YDThQekEqYDGQuFZastMFBknlRy2BJUlxkEwPSOmYHV84Cz6v65aMAqAHO5D15D57kcC1NQ7gNiVPVWCmLac1i3A4RdtJ6HHaQDT2BOZDHb9igtLeZG5GIlssiOPhrG0N7+nFX+Gij+P/GMMEjjuKVvMUyD/jLSIRhQBJ7MTW7vznbUiKNlZ1T8BuvFq71A8C34BkYvzV7y23YlVKODa4F/Mfkyx0s8QIJ9Df2URP9+VUhyFa3ni+Ckiq1him52IfrDtCTAEX+Ga3K5JV/enAEDSzWeSm0logjiCssbZctIEa2SEJLVivRi2FGh17ajvi2mUcTCJrFvOYry4lX1UDbBQZoeTV4nwfnf00nhZgXG93wzb3uNW0t712Jli1vc2RDTurj4wQ7euEYg/73pIrR05nf4kK0GKNCLRnDibjXX0IVpEkqJj1t/46 ek81Alko sNzAhPAsMLMw/5yWaQveJ3XUNsbRRo6/FpRmNRbnmcvYBdJmCTAko3YxQt9bwUk8w8MHTnNenVYca8qQe8EUkmdzsBZRAXRmwccQQTDIJtltvnC4xnXyb/qbwvFQXdPHazJad6EprWJjW0C2wLtsFkEvunR/5Itj6pOF1e8eW3cCGqfSUaNWJs3hYcCkQZRfvmJNwXRJgwlzG/5BX8Xx2rku1+a4cR2AIN+3BvPU+xdv0fE1oOEJRvdlnmEYU7S2q1yhoSfdfIntixL5qmiT1isjnF2QxeoG+mNmb2DjtGP7MzD8jr2gZ1TIhvlj4rgVsdW8hjbXetcfoF+WZcsECJ0Ovhnu/e+QyR7ZkGnWoxB+Qn0loIb9NC/I4PW9sCs3Ur5QYZ6dCmK7EP9TH/kJy1BTgtrnJ7qy24QxwjTOFiEM4l3sIGQGrOMZItZP56DM9p1A2DwP0ojj1bf+88QuK+FTPkbFyCEduupvo 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 |
khugepaged: mTHP support
|
expand
|
diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 61a349eb3cf4..046843a0d632 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -643,6 +643,11 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma, folio = page_folio(page); VM_BUG_ON_FOLIO(!folio_test_anon(folio), folio); + if (order != HPAGE_PMD_ORDER && folio_order(folio) >= order) { + result = SCAN_PTE_MAPPED_HUGEPAGE; + goto out; + } + /* See khugepaged_scan_pmd(). */ if (folio_likely_mapped_shared(folio)) { ++shared;
khugepaged may try to collapse a mTHP to a smaller mTHP, resulting in some pages being unmapped. Skip these cases until we have a way to check if its ok to collapse to a smaller mTHP size (like in the case of a partially mapped folio). This patch is inspired by Dev Jain's work on khugepaged mTHP support [1]. [1] https://lore.kernel.org/lkml/20241216165105.56185-11-dev.jain@arm.com/ Signed-off-by: Nico Pache <npache@redhat.com> --- mm/khugepaged.c | 5 +++++ 1 file changed, 5 insertions(+)