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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 552A8C3DA7F for ; Tue, 6 Aug 2024 02:17:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE5F66B0093; Mon, 5 Aug 2024 22:17:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D961D6B0095; Mon, 5 Aug 2024 22:17:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5E526B0096; Mon, 5 Aug 2024 22:17:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A5EB76B0093 for ; Mon, 5 Aug 2024 22:17:57 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 572D941E8D for ; Tue, 6 Aug 2024 02:17:57 +0000 (UTC) X-FDA: 82420210194.03.DC59ED2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id AAE8714000E for ; Tue, 6 Aug 2024 02:17:55 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=m2uYnoZx; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.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=1722910625; a=rsa-sha256; cv=none; b=JBgWApADbWJ0Ubs0ijtymD6n+Wxoey4eZhGGNdgHIwibqIuzdIsKtKcFY0w2T5wwxTE9nc TfTCWwUMUPZ6y4u9vSyQP1ZQRQMcra6A8xEgmusaMXXkOOe4iXg6RZMSma0MhuZC86VdL/ ThGOgq5M5CjTB57HFxdsfNKCzeFwseI= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=m2uYnoZx; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.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=1722910625; 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=4QKFa1vbmbzCmX4gVELLmb5iYGeWB2gX7ROj6JJouI0=; b=Qt0/AtC2/IHIGE0YvnNYW6nQmmZ+OR1zcN/pkWs3S7R04+4wCfQhQVZjwKjXT5t3cWeBwh +UO+ukDutL+EvjAduQRb0SQMnkLgRxx5hWUOmm9GfZxmxDwUQFzAxVFRZ/B5WXXV7Yyuiv 6lGK3D8uf/cRQTRxvkTY+ZlW2q7o/bc= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D180460EC7; Tue, 6 Aug 2024 02:17:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5959AC32782; Tue, 6 Aug 2024 02:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722910674; bh=yXVABbkmu8OTawq0fw52gNq7FEB6YnC9rfwX9dBxipE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m2uYnoZxR8xMBazV/hBgxgY81G3IXq7Xti+2mJZaEDWlhaCvFzCpg8/8LndrC02+d 0zXoDHYOX4iKnA9+Nlqx5RdEbkv+eFVbpvAiIh1SrP47yve+P3MaHrvhySrz9+Iioq dnEdB9mDMxO6jlTPGe5NslxhBy6VyDMui3GJg1RtYVbeOcyDNDrQ92AmDKKSGlYrD3 3XS0v5Df+AdCXcaWMhzH0BUCvBpyYCHLEYr87jL4LIWxzb2TcCqPVj3sYz59Cd2Aaa FJ38L9N604JzZGqUxC/heCvKbkZ+3oXCoIVhQSaOHEJyQJryAjLFb4dD890SWQXqQE NJholuQNSG2Lg== 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, Yosry Ahmed , nphamcs@gmail.com Cc: Alex Shi Subject: [PATCH v5 00/21] mm/zsmalloc: add zpdesc memory descriptor for zswap.zpool Date: Tue, 6 Aug 2024 10:22:47 +0800 Message-ID: <20240806022311.3924442-1-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806022143.3924396-1-alexs@kernel.org> References: <20240806022143.3924396-1-alexs@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: AAE8714000E X-Stat-Signature: y5mc1bm6jr9n3bosunzeawg6ieh7qrxi X-Rspam-User: X-HE-Tag: 1722910675-881330 X-HE-Meta: U2FsdGVkX18aY7LvfCT/j856iph0N0LWrvLiQv/v/iGH1diZtqMNedxiNKY3EolOvBfmheS6hl49XDvSjfVsAvcgms6X79ag85YFKZKwgIMiunGQEIsdleehkoYJznJxfhwAqJfYCkLMEAlLRgwV1PL0BI+KLgNvpg9HbSdmPm8rpFpV+mvqLHku5tE60HSTIF0pGK5+BOM6Li1xPX9MRNsm8/0PEwCdB+ZPQYX+dLPA51GoD4YrC6jt2O8j9qNcVJ/Ob9uph5iF8FzK2bN3MuG9SNDIpIeCIY/uMyAJL5eRjkRm0w/LRzM6doslJsjKuqUqZiSq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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 zsmalloc 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 zsdesc, since there are still 3 zpools under zswap: zbud, z3fold, zsmalloc for now(z3fold maybe removed soon), and we could easyly extend it to other zswap.zpool in needs. For all zswap.zpools, they are all using single page since often used under memory pressure. So the conversion via folio series helper is better than page's for compound_head check saving. For now, all zpools are using some page struct members, like page.flags for PG_private/PG_locked. and list_head lru, page.mapping for page migration. This patachset does not increase the descriptor size nor introduce any functional changes, and could save about 122Kbytes zsmalloc.o size. Thanks a lot for comments and suggestion from Yosry, Yoo, Sergey, Willy and Vishal! Thanks Alex --- v4->v5: - rebase on akpm/mm-unstable on Aug 4. - add a helper and update code comments accroding to Sergey's comments - fold patch 20/21, remove 3 helpers functions according to Vishal's comments v3->v4: - rebase on akpm/mm-unstable Jul 21 - fixed a build warning reported by LKP - Add a comment update for struct page to zpdesc change v2->v3: - Fix LKP reported build issue - Update the Usage of struct zpdesc fields. - Rebase onto latest mm-unstable commit 2073cda629a4 v1->v2: - Take Yosry and Yoo's suggestion to add more members in zpdesc, - Rebase on latest mm-unstable commit 31334cf98dbd --- Alex Shi (10): mm/zsmalloc: add zpdesc memory descriptor for zswap.zpool mm/zsmalloc: use zpdesc in trylock_zspage()/lock_zspage() mm/zsmalloc: convert create_page_chain() and its users to use zpdesc mm/zsmalloc: rename reset_page to reset_zpdesc and use zpdesc in it mm/zsmalloc: convert SetZsPageMovable and remove unused funcs mm/zsmalloc: convert get/set_first_obj_offset() to take zpdesc mm/zsmalloc: introduce __zpdesc_clear_movable mm/zsmalloc: introduce __zpdesc_clear/set_zsmalloc() mm/zsmalloc: introduce zpdesc_clear_first() helper mm/zsmalloc: update comments for page->zpdesc changes Hyeonggon Yoo (11): mm/zsmalloc: convert __zs_map_object/__zs_unmap_object to use zpdesc mm/zsmalloc: add and use pfn/zpdesc seeking funcs mm/zsmalloc: convert obj_malloc() to use zpdesc mm/zsmalloc: convert obj_allocated() and related helpers to use zpdesc mm/zsmalloc: convert init_zspage() to use zpdesc mm/zsmalloc: convert obj_to_page() and zs_free() to use zpdesc mm/zsmalloc: add zpdesc_is_isolated()/zpdesc_zone() helper for zs_page_migrate() mm/zsmalloc: convert __free_zspage() to use zdsesc mm/zsmalloc: convert location_to_obj() to take zpdesc mm/zsmalloc: convert migrate_zspage() to use zpdesc mm/zsmalloc: convert get_zspage() to take zpdesc mm/zpdesc.h | 146 +++++++++++++++ mm/zsmalloc.c | 482 +++++++++++++++++++++++++++----------------------- 2 files changed, 403 insertions(+), 225 deletions(-) create mode 100644 mm/zpdesc.h -- 2.43.0