From patchwork Mon Dec 16 15:04:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyeonggon Yoo <42.hyeyoo@gmail.com> X-Patchwork-Id: 13909878 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 54480E7717F for ; Mon, 16 Dec 2024 15:05:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B6D006B0089; Mon, 16 Dec 2024 10:05:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AF3B86B008C; Mon, 16 Dec 2024 10:05:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 96F146B0093; Mon, 16 Dec 2024 10:05:12 -0500 (EST) 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 73F336B0089 for ; Mon, 16 Dec 2024 10:05:12 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D7226A111D for ; Mon, 16 Dec 2024 15:05:11 +0000 (UTC) X-FDA: 82901144382.22.4BFE841 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by imf11.hostedemail.com (Postfix) with ESMTP id 0C55E40008 for ; Mon, 16 Dec 2024 15:04:42 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=PjY1KeRm; spf=pass (imf11.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.179 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734361487; 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=e6unaxnw11xkzDQryKSRgKWtxNiggusoGBN8TNB1fx4=; b=2afteFH4iGeBz/7KG0Rw4UPgIWM1SltVpd+bDuwRaQEHGu5GUK5LSOL/Zo+z4qEA5QyB3B v3ry35d5ohVnPhkNf0GhEw6VTmA9NwKF/v0H7GphPrzkePXdOSNpS2GEfyk61hxL3FBBy5 RrcSthgBAGqh/7IiD6wscLPO2hqGPpo= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=PjY1KeRm; spf=pass (imf11.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.179 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734361487; a=rsa-sha256; cv=none; b=kXPpdqqYnSJ6uf1KLjN2rfrq6mlOVUjc1q2BhESEc1ctw1c+Rh1lC/Ms6EE6ebk+nzQBxI TVU0LzkewqbP6pMOYO74szNr4w5hDwUH8v66WydmaDmsUVOmCLoFw80FPUXWGx/9L1OQsV b9sQyc78rCTs9FLguf4Rbk/iZ39L6lQ= Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-725abf74334so3611972b3a.3 for ; Mon, 16 Dec 2024 07:05:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734361508; x=1734966308; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=e6unaxnw11xkzDQryKSRgKWtxNiggusoGBN8TNB1fx4=; b=PjY1KeRm+TU31g9tRHPdqJgJemvITJLiC5dexvj+Mfi69H1t7SLoEGGf2DSuAadwY9 dPr0A7U1HQ1ce8vnvVE0+qcVHKUdhCZmVtI1l8rdICMvhMSjlqeUvF4Ulw367KgRuyw8 caR9OYjl/kaw7c1f8pFIeDml4Q9GsmAND7flb/QBiu0XlfKlzmMOSJ01FJBTetoGfEIO 4rgLm8/VDcdyIdciDICMJ7OQJ5gr2B0p7fMnHFfPkvC+XmH7SVCzt94eUMKCKqxlR071 d0mK7xDbKZw1aSTneiTeBn22Po+00DErE66Y1D+AEmvshVmyXAdf5wGr5VSgXXHci3wV q5iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734361508; x=1734966308; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=e6unaxnw11xkzDQryKSRgKWtxNiggusoGBN8TNB1fx4=; b=Gr5t69Ul3FidRzvpCeOCmXJ8tHy4xzeaoSGXcQuRVxKuddtUAvx43tHg1Vi2s7mr4c fQxN0aLsr2TOKztESLgMvsRQTo4Al5M5y87TjWRg/lzZ3sQICJG/ivL+pCyLeuNweBK3 d+FXJrj66cuVsFa8Qp/AXCt2rgBhT4bE6gP1rQ7giYRrnSFiFwNBRFU2Vz0syxE4k81S w0ol1QW/4o1os1KMTALtn9pSwG0zvI4a2a6eCx99VHMBLOrOimhyqL9aQ/oc2GvUs9bV Gh2m5OWKJkYCI9OC1Xtke9V538SH3NjX4a+vP3j2QY2AlgLn623Tjl++U9zHMW8EjHW4 49SA== X-Forwarded-Encrypted: i=1; AJvYcCUoT+JMuk4K5FiMNpGJ21+MmQVmWw3/LpAmF7oZQcKzqRa+SOpYk+EYmy9Zjtwrpi1cpWPssDBWfQ==@kvack.org X-Gm-Message-State: AOJu0Yw+txNiUKqw2lBRyunOqDGSS3kLGbIUNbBdOpDCMVGuYS0vdgl7 UoLl6NfeMyuWbDNkznyP0sBUuU82kMGEqe7ajA3omPSN00WRYk0e X-Gm-Gg: ASbGnctw/78tIxmcehQvh4l4n/9OtLgr9PnR/Tp/k3GFENa8DNJpiaJddhohc1QEwYJ 1WxVoFvgXokTUQZhua4I0Lhivz3iQru8TSCVqHvsUQncK59T3zYvn7Or193WttNaUpxPa6fbLAj 53/wp2qY20ZTMAG8ROBWVGiTeV9HfDl0kBOHMOmuDpJDDPzxvYeMCOk+h/Rthm2iFmzk8F3YMm8 RuPTRAc/uDmzvXbi7UjJV0A2tawpFv81fte4E2D6jQh8AiIPT5MAeskhJpU82flR0M= X-Google-Smtp-Source: AGHT+IHk2QTvy3Glz9C+5l2JbN/aeLWoEVGMZN2zH+FlwXiHKm1jwDHuoHomasFF9E24qVxbqDHVTg== X-Received: by 2002:a05:6a20:6a11:b0:1e0:e027:2eaf with SMTP id adf61e73a8af0-1e1dfd6a365mr19843770637.19.1734361508170; Mon, 16 Dec 2024 07:05:08 -0800 (PST) Received: from localhost.localdomain ([1.245.180.67]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72918ad5ccdsm4845518b3a.74.2024.12.16.07.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 07:05:07 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Minchan Kim , Sergey Senozhatsky Cc: Andrew Morton , linux-mm@kvack.org, Matthew Wilcox , Vishal Moola , Alex Shi , Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [PATCH v9 mm-unstable 00/18] Add zpdesc memory descriptor for zswap.zpool Date: Tue, 17 Dec 2024 00:04:31 +0900 Message-ID: <20241216150450.1228021-1-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 X-Rspamd-Queue-Id: 0C55E40008 X-Rspamd-Server: rspam12 X-Stat-Signature: 7n5aciami56cxmzm91ah9seiycker4sd X-Rspam-User: X-HE-Tag: 1734361482-210850 X-HE-Meta: U2FsdGVkX19JKGqcMudJytjXEHmG7vQh+e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XvY06nRQOgVqMfdlLMi42cZsGx17BmoraPN4DnDSqJECB7ZPgbpsmljz9CMoUULdlbIBiF4LWikV2NNAz+nVcsoKyS7yCCi/zK3Ver5HgaPEnDg6q/3w42xkuYLBskpH1v8Vlixt2pf4WQ2/V8Jz5wVjX1ng0LoCZOj4U70u/A7pxZLmrlJcUjJTzpVK2B/qxY7IyZLsz8yM5oM4gb8sa6ncKXB36F5K8yrwbORemS+uhO0F4RmOAP+M1KKM6eGtIU5GPFi46ZQ37Tp+dwrCyp0a/RovSpxPOkvWr/6bDncdZBarONv/gQSq9oJEqwG3ZOiycWlW+IvsRncdarYBcI7Xt7Wttw4ynURxzcy6eyZBZ60E+3Ztu85nUJ2eYkhviYp0ybhF59wHkg== 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: This patch series introduces a new memory descriptor for zswap.zpool that currently overlaps with struct page for now. This is part of the effort to reduce the size of struct page and to enable dynamic allocation of memory descriptors [1]. This series does not bloat anything for zsmalloc and no functional change is intended (except for using zpdesc and folios). In the near future, the removal of page->index from struct page [2] will be addressed and the project also depends on this patch series. I think this series is now ready to be included in mm-unstable if there's no objection. Sergey thankfully added Reviewed-by and Tested-by tags on v8. But as I updated the patchset, could you please explicitly add them for v9 as well? A range-diff output is included at the end of this cover letter to help review. Thanks to everyone got involved in this series, especially, Alex who's been pushing it forward this year. v8: https://lore.kernel.org/linux-mm/20241205175000.3187069-1-willy@infradead.org [1] https://lore.kernel.org/linux-mm/ZvRKzKizOfEWBtJp@casper.infradead.org [2] https://lore.kernel.org/linux-mm/Z09hOy-UY9KC8WMb@casper.infradead.org v8 -> v9: Functionally very little change and most of them are comment/changelog updates. - (patch 1) Added comments for basic zpdesc helper functions, some bits copied from struct slab. - (patch 4) Changed 'f_zpdesc->next = NULL' to 'f_zpdesc->handle = 0' as f_zpdesc here is for a huge zspage. - (patch 17) Fixed a mistake in a previous rebase from v6 to v7. - (page 11, 19) Changed reset_zpdesc() to use struct page for robustness against re-organizing zpdesc fields. - Dropped patch 20 in v8 as it does not make re-implementing zsdesc management easier in the glorious future. we can just re-implement the whole reset_zpdesc(). - Dropped patch 21 in v8 and folded some comments of the patch into patch 2 that introduces zpdesc_{un,}lock(). The rest of the changes are changelog/comment cleanups. Cheers, Hyeonggon Alex Shi (7): 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: convert reset_page to reset_zpdesc mm/zsmalloc: convert SetZsPageMovable and remove unused funcs mm/zsmalloc: convert get/set_first_obj_offset() to take zpdesc mm/zsmalloc: introduce __zpdesc_clear/set_zsmalloc() 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 two helpers for zs_page_migrate() and make it use zpdesc mm/zsmalloc: convert __free_zspage() to use zpdesc 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 | 182 +++++++++++++++++++++ mm/zsmalloc.c | 436 ++++++++++++++++++++++++++------------------------ 2 files changed, 408 insertions(+), 210 deletions(-) create mode 100644 mm/zpdesc.h