From mboxrd@z Thu Jan 1 00:00:00 1970 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=-11.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 CA7ADC388F9 for ; Wed, 11 Nov 2020 20:40:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4085B20797 for ; Wed, 11 Nov 2020 20:40:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=sent.com header.i=@sent.com header.b="ArZDMod3"; dkim=temperror (0-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="fO5Nrhfv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4085B20797 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=sent.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6000C6B0074; Wed, 11 Nov 2020 15:40:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4EC436B0072; Wed, 11 Nov 2020 15:40:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3144A6B0073; Wed, 11 Nov 2020 15:40:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0024.hostedemail.com [216.40.44.24]) by kanga.kvack.org (Postfix) with ESMTP id 003BA6B006E for ; Wed, 11 Nov 2020 15:40:45 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id AF11A180AD802 for ; Wed, 11 Nov 2020 20:40:45 +0000 (UTC) X-FDA: 77473306050.27.wren24_4000fc527300 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 9101E3D663 for ; Wed, 11 Nov 2020 20:40:45 +0000 (UTC) X-HE-Tag: wren24_4000fc527300 X-Filterd-Recvd-Size: 6789 Received: from wnew1-smtp.messagingengine.com (wnew1-smtp.messagingengine.com [64.147.123.26]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Wed, 11 Nov 2020 20:40:44 +0000 (UTC) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 51EADB2F; Wed, 11 Nov 2020 15:40:41 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 11 Nov 2020 15:40:42 -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=2sl0hzEO2/NiJTtpzxt0U3pBP+ C9s4dcDTT4dzafDPo=; b=ArZDMod3L9ZYYUSziIS9vaKt50TESpps3cLmeg9cG0 7RFLLYc2uxpPVSsLuqytAhBjqsOqMHo0zjS3HmWwrlUy7MwPnpNJcQFdyEyW52MR hh0XmwvBSkPL8t/aqGulika0uVtWECwx6tuWexYIoEVxk0WblYzRqPWdN+SMqVBb CN6BfJ53OXdFQFZt46/9v7XC5T+8AThGu18Xla/wVC2D0a45FCjnnW2sdGjkfBaP Ve5jqXi2xFvU2236mGX4gDDYjzW9zgh7ll3eVu9DXr3Q/86AxZ/DAwWE2SjUm5C9 JiDCGA6qTudBRb2503yPvVwodkeseg1O0O1rWZbxQx8A== 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=2sl0hz EO2/NiJTtpzxt0U3pBP+C9s4dcDTT4dzafDPo=; b=fO5NrhfvxbYIOoJbO3uzLL 2TfDImSoUqelLhT5J1WOHlHKi20wwXm1klVWQLaZgw25t+5et257/iTS9wVNdJeW tIVvvAtvaylEI5ht5QrTrGwxkrDCjlD4RxE1c6SnUTg3cKlpqCtS/t8OYkF//TQx 9OPBj44o9hIUr/2oGimltmbOt69MWxpYIvDTNgRmI4lJ3tY7Twda1yJSltRbidv1 f3RRupFNhhgok/q6i2lVyPkEw7kCq/2ieMFf4CcFt/EKAurez3jB0ipzQj0+X7Uf vxejILPZtBqsOMK+yKrGtfG/LujfSzS/JMNn2nA9hYIN9PaD64MqkmAYTBbHP3NA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddvtddgjeekucetufdoteggodetrfdotf 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 833F3328006A; Wed, 11 Nov 2020 15:40:39 -0500 (EST) From: Zi Yan To: linux-mm@kvack.org, Matthew Wilcox Cc: "Kirill A . Shutemov" , 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: [RFC PATCH 0/6] Split huge pages to any lower order pages. Date: Wed, 11 Nov 2020 15:40:02 -0500 Message-Id: <20201111204008.21332-1-zi.yan@sent.com> X-Mailer: git-send-email 2.28.0 Reply-To: Zi Yan MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: From: Zi Yan Hi all, With Matthew's THP in pagecache patches[1], we will be able to handle any s= ize 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 low= er 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 red= uces a lot of redundant code without just replicating split_huge_page for PUD TH= P. The patchset is on top of Matthew's pagecache/next tree[3]. To ease the tests of split_huge_page functions, I added a new debugfs inter= face 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) split PMD THPs, 2) split pagecache THPs to any = lower order, and 3) truncating a pagecache THP to a page with a lower order. Suggestions and comments are welcome. Thanks. [1] https://lore.kernel.org/linux-mm/20201029193405.29125-1-willy@infradead= .org/ [2] https://lore.kernel.org/linux-mm/20200928175428.4110504-1-zi.yan@sent.c= om/ [3] https://git.infradead.org/users/willy/pagecache.git/shortlog/refs/heads= /next Zi Yan (6): mm: huge_memory: add new debugfs interface to trigger split huge page on any page range. mm: memcg: make memcg huge page split support any order split. mm: page_owner: add support for splitting to any order in split page_owner. mm: thp: add support for split huge page to any lower order pages. mm: truncate: split thp to a non-zero order if possible. mm: huge_memory: enable debugfs to split huge pages to any order. include/linux/huge_mm.h | 8 + include/linux/memcontrol.h | 5 +- include/linux/page_owner.h | 7 +- mm/huge_memory.c | 177 ++++++++++-- mm/internal.h | 1 + mm/memcontrol.c | 4 +- mm/migrate.c | 2 +- mm/page_alloc.c | 2 +- mm/page_owner.c | 6 +- mm/swap.c | 1 - mm/truncate.c | 22 +- tools/testing/selftests/vm/Makefile | 1 + .../selftests/vm/split_huge_page_test.c | 255 ++++++++++++++++++ 13 files changed, 453 insertions(+), 38 deletions(-) create mode 100644 tools/testing/selftests/vm/split_huge_page_test.c -- 2.28.0