From patchwork Thu Nov 19 16:05:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 328745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D75EC6369E for ; Thu, 19 Nov 2020 16:07:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DFD6622253 for ; Thu, 19 Nov 2020 16:07:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=sent.com header.i=@sent.com header.b="CpLtsr98"; dkim=temperror (0-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Wqb5mKKB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728026AbgKSQGj (ORCPT ); Thu, 19 Nov 2020 11:06:39 -0500 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]:55839 "EHLO wnew2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727981AbgKSQGj (ORCPT ); Thu, 19 Nov 2020 11:06:39 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 48A33EB3; Thu, 19 Nov 2020 11:06:37 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 19 Nov 2020 11:06:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=from :to:cc:subject:date:message-id:reply-to:mime-version :content-transfer-encoding; s=fm2; bh=dLIW2nC3tgzPsBDCQkc84OS0Xh 6vYPtftB1fXGqMVrI=; b=CpLtsr98SAgyFocJmYPq07EdmM+nUV6FzPJYWWJgge uiXti30M5OSRaoBzKg8GnTsPYzK7g/gAggENapK7Qv6HB+BWTPTLtAuZdjv1qj4R U4uqWKKTPBpxzWpdrNznwrWVmIINwble7/Li2stsRfMGyeFJRyPFkde874AzqLxy jHFDMKnrtdRniFI+2m0BZ/D/zjzDPn/46mkcROetBbhhmW02fGSSpKaMkxj37Ik0 skRr5u+cobycP44DTQnm4RZ5XYdCRBcPSLAiTg+FGPxT0lwXn+jFjUmpxcYS1S78 VQIHWK2m/qAzD6eAsynV/gUt6tUlNoNcLPyG2ihElECg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:reply-to:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=dLIW2n C3tgzPsBDCQkc84OS0Xh6vYPtftB1fXGqMVrI=; b=Wqb5mKKBMz+CgrkhqAIS+c 6n0qS28piVAUuYE/2lAlkXyh/V7AEJpkYp1T3T72GQwP6Aud1J4dB3SG5IacDL3m Xo6Rr4iXB4citonkIzWgxRtadEbZXAv7kxZ4zhV12XCUikTtngRdTaomCOx2af3m AZkCShsQ2rC26YZNlunpo+WrtwgCVdbexfwaA3xDFjtQ2P5rlYHkpgzW/WynQW/e 1vnI/Onl9XyuDHVcjBTGgGqvnKSv2MDfkYE9d1JTDS7bJKpQ3lytRinmgR6JumCm vpyGgWR8gEzK5aOpOX6Q8QIR9AXOsURux6MMmx028q5GuEkWzM7EhmIYjWGemufg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudefjedgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfforhgggfestdhqredtredttdenucfhrhhomhepkghiucgjrghn uceoiihirdihrghnsehsvghnthdrtghomheqnecuggftrfgrthhtvghrnhepgeegieehgf effeffleefgeevueegvdffteffhefhkeevvddtjedvudeljeetvdegnecuffhomhgrihhn pehkvghrnhgvlhdrohhrghdpihhnfhhrrgguvggrugdrohhrghenucfkphepuddvrdegie druddtiedrudeigeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpeiiihdrhigrnhesshgvnhhtrdgtohhm X-ME-Proxy: Received: from nvrsysarch6.NVidia.COM (unknown [12.46.106.164]) by mail.messagingengine.com (Postfix) with ESMTPA id 8953D3064AAA; Thu, 19 Nov 2020 11:06:35 -0500 (EST) From: Zi Yan To: linux-mm@kvack.org, Matthew Wilcox , "Kirill A . Shutemov" Cc: Roman Gushchin , Andrew Morton , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Yang Shi , Michal Hocko , John Hubbard , Ralph Campbell , David Nellans , Zi Yan Subject: [PATCH 0/7] Split huge pages to any lower order pages and selftests. Date: Thu, 19 Nov 2020 11:05:58 -0500 Message-Id: <20201119160605.1272425-1-zi.yan@sent.com> X-Mailer: git-send-email 2.28.0 Reply-To: Zi Yan MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: Zi Yan Hi all, With Matthew's THP in pagecache patches[1], we will be able to handle any size pagecache THPs, but currently split_huge_page can only split a THP to order-0 pages. This can easily erase the benefit of having pagecache THPs, when operations like truncate might want to keep pages larger than order-0. In response, here is the patches to add support for splitting a THP to any lower order pages. In addition, this patchset prepares for my PUD THP patchset[2], since splitting a PUD THP to multiple PMD THPs can be handled by split_huge_page_to_list_to_order function added by this patchset, which reduces a lot of redundant code without just replicating split_huge_page for PUD THP. To help the tests of splitting huge pages, I added a new debugfs interface at /split_huge_pages_in_range_pid, so developers can split THPs in a given range from a process with the given pid by writing ",,," to the interface. I also added a new test program to test 1) splitting PMD THPs, 2) splitting PTE-mapped THPs, 3) splitting pagecache THPs to any lower order, 4) truncating a pagecache THP to a page with a lower order, and 5) punching holes in a pagecache THP to cause splitting THPs to lower order THPs. The patchset is on top of Matthew's pagecache/next tree[3]. * Patch 1 is cherry-picked from Matthew's recent xarray fix [4] just to make sure Patch 3 to 7 can run without problem. I let Matthew decide how it should get picked up. * Patch 2 is self-contained and can be merged if it looks OK. Comments and/or suggestions are welcome. ChangeLog ===