From patchwork Fri Jun 21 05:46:40 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: 13706855 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 9AAD2C27C4F for ; Fri, 21 Jun 2024 05:42:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D85E18D012A; Fri, 21 Jun 2024 01:42:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D0E8B8D0111; Fri, 21 Jun 2024 01:42:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B88258D012A; Fri, 21 Jun 2024 01:42:12 -0400 (EDT) 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 982778D0111 for ; Fri, 21 Jun 2024 01:42:12 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 10835C092A for ; Fri, 21 Jun 2024 05:42:12 +0000 (UTC) X-FDA: 82253800104.29.054E26D Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf13.hostedemail.com (Postfix) with ESMTP id 243CB20015 for ; Fri, 21 Jun 2024 05:42:08 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=c4uMpUuK; spf=pass (imf13.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718948519; 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=H9LrMjeoOfCM4Lv+brGFsc+pjlFoO89hIP7Ub7hq/Ec=; b=1nPYPr47lFrv279dd/e5ooQq+NXa/ZfOVCVP4mLzc+XjYqA0mG26aent63153Oa2zTx4ml 0CvutakLO2PsNh2krfKEEeHb5sd9jpuXxKBQcMpmisMyErO6dsgHFs7tQ6RRpYOY6zWVcg pOQspUl3d+dwAyrlVewzAKFkXkiykek= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718948519; a=rsa-sha256; cv=none; b=coi/WpuhxJu3daKFirmxDEoWM59zhzq0MBtJlXUFllgpaQI/8bWN5S3gjE7LkW41e9W2u8 3qPno07UVbiqaZ52A3VDw1Ps973PEwiEBLOd8/XcK8N/EM5RBI/QFUuYGLqEWogL7/tl8T zc0uDHk/1V30jYFYYi1ah5E/B8mQvug= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=c4uMpUuK; spf=pass (imf13.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id D5A5CCE18BE; Fri, 21 Jun 2024 05:42:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98E3BC4AF07; Fri, 21 Jun 2024 05:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718948524; bh=sI3HdF7oTrLQQ9ZG9TlqrCSIuiaexC6T0mWrx6bDeLE=; h=From:To:Cc:Subject:Date:From; b=c4uMpUuKiB3ymxKZ4d3CCkA+d78gA+pzEW4h2VFSgPwieQkyE0fb+oWqhZh+N/751 5k14M8haVEnEZqY0Dt19zZoaeAmta3D+LtEnrkwE7ffSBDIL5mcaGPwuek9AcCIObY uOJqVBSlNTsjsIDf9QwjVB5hAXXUairt/6DNojxuA0DSDUSxeqAhgpwVy/MBk/DraB EshaeK0s59xoX5sHBL7dW5PVokeIroViWdmN8BXKgclikxkzAXjAcFNn0opNNlC5jh k5P9kgiJAIK5HQeiUTNOCSMlE8GEPLsEZONxEAb6q2WlHHgWUrcNGqt865D/wOmGQD oFsRnTb8azwlw== From: alexs@kernel.org To: Vitaly Wool , Miaohe Lin , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, minchan@kernel.org, willy@infradead.org, senozhatsky@chromium.org, david@redhat.com, 42.hyeyoo@gmail.com Cc: Alex Shi Subject: [PATCH 00/15] add zpdesc memory descriptor for zswap.zpool Date: Fri, 21 Jun 2024 13:46:40 +0800 Message-ID: <20240621054658.1220796-1-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Stat-Signature: md4gc1szwx3fj43h34mhf8br9gybxjfq X-Rspamd-Queue-Id: 243CB20015 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1718948528-428017 X-HE-Meta: U2FsdGVkX18oKfFMdLeqozH1qfvLq6VH0YTW1r+Gqrf4WGJ27pH3t0c+4a9J9AhmbyC17w3RoZT3uEHen5r9GBgkOvi/HBxxITmiJAQCI7NRvybnwYHqQpq7Kz+TTRdGuEH9D5naUwjE9F2cxGRmLlCu41ZYgPAFZf+j3SKKHRcsJMjnkdnq7C17gFKs8lZjXGEv4pagPe/SNE8GjHWjyASSN2zqki/ewb9frqwji/gK/CKtj9kBlBuizeV56oPkSgA84PfOwsDHkkiTqGS/r7F6EPZbq1oib2xs5GlZCV8t+78eiqzhR7AxUj0rEAQF72bNk06jhqKT2OC2bbxQ3z1VfscGg7ptO1M4quqzDh76i3TKtJy3qxib6egrC8SQmlvuYQICb8wglNax4pg8/iBfZxW40C0SAT482kEkWUe5dvR6b/XM19Cfm31MopAYfqhCFKL9xpkp07Laax92ywfndWHxixNI+rBiEsZIefmxAypvJXvoxCTyO7trmB5bvjr/yk9ahOBt60uTrsiywCnaslf+UEaXLImx0sG0tNB6uqWHOhzAdZfHoLHjaU5uWGyJVxlCv1s7BmQyYM1JB+J1BIr14MzwlQJDSy7fwLd49+FdJJ48d4gUOhKVBD46WJtzfJAfJb6mzcZLoe2i9IFm2HOif91cYQe4Dc8PXAXpzIpUhqJo0A2YV/VBwYKqhp6Nbw1qPDLvX8xoTpVQUZCpTUz2gpV07/y90P0CiU4pQ3zoKsB4pmeqg/L0CyFqb7+x3xkoRUR5KWP2ueHa4E4ybQ6xKlscGncLJ7NWIVZJfVgRPOcuvQ0obj6QL/Z1bknGSZSM+w8Gpb/hkwyxYJQ+zUzfOcEd6kijyaqrDcldmd9DQEeLpZYE1aAtbAgdkBudfOs1XKgwqpkQj3yeCmB689gWr/58amOEoY3j9yA0NelrleMRfcL8PYcjDn+ZIRfxgrzR4+6SXvByMaa imVEmCmN ct2g1nRV3QiEFx8T3AkkLI5FfCDlVP0TMgNUiiJPWnERgPMqDxNqgXZ7RAqVynNUlpBv5hyr22y7rAOL27FyeOLXbs/87SV1sCz2iiK0pB5ytCnf/S01xNdbPsWEjqKWcarT78VUua5lyaJVggihlFB3Fcy0Xqo4mZkyqopkJZGDYr7uxjyQiRRy0QXrLihEMxooCz1cyYQurqi0j72alN+hUUu+RPv8m7avnQXCUuudxI9L6HIJCNNqFRO3tuyb2ki196ismt1zOTMkphm5PpUP/SqBl57rUwRasPG8+vUSyOnC2Q54C7flJsci/NnicGLhvuFtxygSQt6Ut2Xz0rK1Waur6nVGAtO7qlazOFeZiuIYWbXnzs2GriGhIPEe5cKibnp9D+jy0SXeVeIZLDOs7sg== 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 According to Metthew's plan, the page descriptor will be replace by a 8 bytes mem_desc on destination purpose. https://lore.kernel.org/lkml/YvV1KTyzZ+Jrtj9x@casper.infradead.org/ Here is a implement on z3fold to replace page descriptor by zpdesc, which is still overlay on struct page now. but it's a step move forward above destination. To name the struct zpdesc instead of z3fold_desc, since there are 3 zpool usages under zswap, zbud, z3fold, zsmalloc. It looks like we may extend the zpdesc to zbud and zsmalloc, combined their usage into one. For zpdesc(page), z3fold just uses the 5th member zppage_flag, which match with page.private. Potentially uses the first member flags for headless PG_locked, list_head lru and page.mapping|PAGE_MAPPING_MOVABLE for page migration. This patachset could save 26Kbyetes z3fold.o size, basely saving come from the page to folio conversion. Thanks a lot! Alex Alex Shi (15): mm/z3fold: add zpdesc struct and helper and use them in z3fold_page_isolate mm/z3fold: use zpdesc in z3fold_page_migrate mm/z3fold: use zpdesc in z3fold_page_putback mm/z3fold: use zpdesc in get/put_z3fold_header funcs mm/z3fold: use zpdesc in init_z3fold_page mm/z3fold: use zpdesc in free_z3fold_page mm/z3fold: convert page to zpdesc in __release_z3fold_page mm/z3fold: use zpdesc free_pages_work mm/z3fold: use zpdesc in z3fold_compact_page and do_compact_page mm/z3fold: use zpdesc in __z3fold_alloc mm/z3fold: use zpdesc in z3fold_alloc mm/z3fold: use zpdesc in free_z3fold_page and z3fold_free mm/z3fold: use zpdesc in z3fold_map/z3fold_unmap mm/z3fold: introduce __zpdesc_set_movable mm/z3fold: introduce __zpdesc_clear_movable mm/z3fold.c | 190 +++++++++++++++++++++++++++------------------------- mm/zpdesc.h | 87 ++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 93 deletions(-) create mode 100644 mm/zpdesc.h