From patchwork Thu Apr 11 06:17:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 13625438 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 7C21FCD128A for ; Thu, 11 Apr 2024 06:14:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED2A96B0083; Thu, 11 Apr 2024 02:14:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E81726B0085; Thu, 11 Apr 2024 02:14:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D70496B0087; Thu, 11 Apr 2024 02:14:17 -0400 (EDT) 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 BAF5A6B0083 for ; Thu, 11 Apr 2024 02:14:17 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3DD4240A36 for ; Thu, 11 Apr 2024 06:14:17 +0000 (UTC) X-FDA: 81996236154.25.0899F1D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id B29854000F for ; Thu, 11 Apr 2024 06:14:15 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=OVzRFEao; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf07.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712816055; 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:references:dkim-signature; bh=8Vr1duL7Y/DzNu5+Ub4+pO7UQTKy93O+Pj9bGilG8FM=; b=7QH3Q9HA2VBpFkqQbFoHHCv5D0bhj4k0tYmNxKeHgNyC5GMVqBKECxt9tmIKoZULY56QcI yUCGLjyM8Dq2yK2l+blBunkYfgk+ywW00BUod47dSsOwcJb28X8UyXKGCiE392couGeYnH b+llFwLT04EP/d6Zf2BtWngAoEscmgg= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=OVzRFEao; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf07.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712816055; a=rsa-sha256; cv=none; b=LHYPvA9CVmkXman5R/fy0k/AdZYDkxVmFRvUbdvuZ7fTsVo3WrUZuvbEr8nmR/crFcyUyU t/IXjEYPSLgUf+ATGGFxSJitNhTTrqAlgcatrtFOjiLtVXE6DNf0ofw/YIFGe9gZuKmZ2p SW/j/V1R3H/gydiuLYSSdoWmPLTrsKA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id AB30461D0F; Thu, 11 Apr 2024 06:14:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34306C43394; Thu, 11 Apr 2024 06:14:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712816054; bh=+FjVUrA5fdJ/d6cNIYDRyBigkWREtGjUPt3tLRh4HVU=; h=From:To:Cc:Subject:Date:From; b=OVzRFEaoSt0A4KVfm5E7VwlmSq2+5A5/TgVy0mvWq75wHhDkSONuQu6HrN9TFeQeK t+gtz2xqgdoxRur0Dgp6NJlpbat/i81CJwJA2L/jynBh8Q1upFfC1DBiDNGaIcOlmM P1pyg7O2zKYgHNz6RrhZ7HUSE9mFjU9JzuKkPGpB8HUvGZRv1AP/lUPVFFqF5UkdOm 0WAQM8PhfJCvDYNTEA+WeoccqM2cJP7Ka8+7ifacsnQ6SsCAIG/yqVZimoeMdacmac H6A06vD7xZwdYhLipEmoJjLG0vNfuTLRdBjMaxXEzqb25mjVaYCZ15N9uTL7vmKhQl kttN088xOQMAA== From: alexs@kernel.org To: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, zik.eidus@ravellosystems.com, willy@infradead.org, aarcange@redhat.com, hughd@google.com, chrisw@sous-sol.org, david@redhat.com Cc: "Alex Shi (tencent)" Subject: [PATCH v5 0/10] transfer page to folio in KSM Date: Thu, 11 Apr 2024 14:17:01 +0800 Message-ID: <20240411061713.1847574-1-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: B29854000F X-Stat-Signature: n7oue7b386neetp1dsdqirpkwazx3pb5 X-Rspam-User: X-HE-Tag: 1712816055-189527 X-HE-Meta: U2FsdGVkX1/5O0ZJPntDTACCKqWP2POtpKYKuyfIHB1Rl0iihJn8O2j/EPbgy6JF5POIb+vPZM8PA6rGL0Z7E5gsX5tBXWyaCkGZDOHSBrEKRABnmZiiMw8i++csQqc9yumjPk+3EOaf0Ua1vrC7EenPZLPzQv9qsmbZ1nN3aiYNH0qU6netnDICgq3eObo2PUjAlXtwpY66k4jD5l31kQx4CAiVO7xinIcyfEnDoMKJuGe9q1pnCHMIWQj9G0K9sp5KHkU5iuz46l8QK7ruuK6Twzo1saMtEXYd+7zl9P6eGbMTg5l6Ja60Os44IhNh9OI9+YnBmuMaL9nIV+I3+p3KP4yQcsYenRq2U9IWSJJfGRyKFoZO0NzH1CQGmb5xDmv4ITK1Mk6eh11lsw7GhYQFnwTX4NgLRy0iUapEzaFofG+eFw+g9IzTQ5po+pHlMRY5D3IbwV9+T9Pyon3KcUBvb5R1J9xyI1PkJbZ+mvhKJ462Uw0zkKAAJ+fF+m3rH+bVfPVa99LJVVrAG4pr63SXpPM1uB2vntzBIXXVx+DkPSNDxQHoLKYy7kgQBeYc3b/zCFirSGKPam3z9a4bSNauc9qLzgJzbykeUzZuupfurl/9peoCs9lkxTW4jAVWR2H6piiNgn7neJNZamra57H4k329fU6Yek69FOdVFaBYosT0AUnIes83b00peUUs+OonOmDwF1JsEYHMQNCh8iUmFsFAeUZCmr84urNFy6ItuZzDYy6gg0+vswNwnNH01GUNvYNz9fFcwgGP8c35y9DbK4hqS0xKHEZiqX94hMXexGA4+/P6AumFdxv16DwLm+k8AynhGF9YGVSp2AMRWkqIOnBR/Wl8WqUkOXeCv1xPMa6+S7yvayaagoY7vFf+p7r0+HLVwV1lrFKFJIPCjF6Of/JaZrPP3m1sIGwYlt7acsHSq+iO9rVsc4qRt7Fv4Uocvof4BZ6wumX36XB snDot/8N 2t6wtSfZSQrcO4DH8e9pKOlo7zbUwbuShMAJp7upjOeYD/7OxZCWSHcHv/rofe8lVBf9esm1Q6rRCs2KcR/ZE+99pTJjrw0doFXvbb7/OSiBHQb/9hCfo/MwYjd8Mo7Thj/XoESUGc+6IEgfuoU67HjDfhLC7gLLcI8YgfYrce54tSHp9PJN3guCv8r2xTGx1u0BuugTKhwkLp5QVkb2z2NlDMXPxnz3vqzeLW0xMmKVh5YWE1XagvX72dOQjwPd0yQ0GqSvphjbjBjU4fS+wAn5EKw== 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: "Alex Shi (tencent)" This is the first part of page to folio transfer on KSM. Since only single page could be stored in KSM, we could safely transfer stable tree pages to folios. This patchset could reduce ksm.o 57kbytes from 2541776 bytes on latest akpm/mm-stable branch with CONFIG_DEBUG_VM enabled. It pass the KSM testing in LTP and kernel selftest. Thanks for Matthew Wilcox and David Hildenbrand's suggestions and comments! Alex Shi (tencent) (9): mm/ksm: add ksm_get_folio mm/ksm: use folio in remove_rmap_item_from_tree mm/ksm: add folio_set_stable_node mm/ksm: use folio in remove_stable_node mm/ksm: use folio in stable_node_dup mm/ksm: use ksm_get_folio in scan_get_next_rmap_item mm/ksm: use folio in write_protect_page mm/ksm: Convert chain series funcs and replace get_ksm_page mm/ksm: replace set_page_stable_node by folio_set_stable_node David Hildenbrand (1): mm/ksm: rename get_ksm_page_flags() to ksm_get_folio_flags mm/ksm.c | 273 ++++++++++++++++++++++++++------------------------- mm/migrate.c | 2 +- 2 files changed, 139 insertions(+), 136 deletions(-)