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 37528EB64DA for ; Thu, 20 Jul 2023 07:55:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C16CC2800CE; Thu, 20 Jul 2023 03:55:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC76328004C; Thu, 20 Jul 2023 03:55:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8F332800CE; Thu, 20 Jul 2023 03:55:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 999AD28004C for ; Thu, 20 Jul 2023 03:55:08 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 60211801E1 for ; Thu, 20 Jul 2023 07:55:08 +0000 (UTC) X-FDA: 81031229496.02.6711A85 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by imf03.hostedemail.com (Postfix) with ESMTP id 8FC962000A for ; Thu, 20 Jul 2023 07:55:06 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=PEqe4ruH; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf03.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689839706; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aHFb36iaYbmIQpiaPjY1UsgrNY9Yir9dWsTpsYfsO/Y=; b=F/2RJ6Lkt4lo0lrHdLFBRjW0PTreqDBkFfxajIgIfiMweeZIK5l1KFnma86lZVvqiRh1bh /hsROem/VSjI3wb4byRvHHU2qkVEpUdGxGwz0xZT+wN8wUWxpN5GIC5XJQuGuHrofe4JoS uXpiRP1MdbCA6R0mmXCcZbAx+6qFit4= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=PEqe4ruH; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf03.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689839706; a=rsa-sha256; cv=none; b=F5FszrqFZq1cLORl3dHn/hwzIhjoA7z5/+/lmFChSFFHE1+dxPLXljHW5T+Rgkub7pxMYE BOtG6PY07IbEwJxA0cf5qB/zyg6FnPwugmbIWRR2eCiIESF3ujPvBejkEdiyGs2SzHZWKD c/ZyOLGNmWVK3Mp3InQGGb6uALdBUTA= Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-993d1f899d7so89816066b.2 for ; Thu, 20 Jul 2023 00:55:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689839705; x=1692431705; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=aHFb36iaYbmIQpiaPjY1UsgrNY9Yir9dWsTpsYfsO/Y=; b=PEqe4ruHyk32s21hEI0BYSGI6sM5iPgLa9g7fazDCUfq/8uXwcy036XW35VUrzu6Eq VXHAwzavoJtdW7C0bSscjTBpx07pSovrWIhIqi0kVx6xGxsXFhwbYetpPVtsoUDV+fK7 EtYkbOi6lTAUSGwFlw/l5Azr3/OHJ5AZ7e5R4wYSyathAw/3qTEb3mnu50bWywbFaSd3 GbTCNQZnVhRtocELnalPPASEBmbAR5Yt1hkej5BmlywhRX+NxVoKgtcSlzTbgXk8lQnl CzE7M1qRMMO4wUaOfRoAZIJajIZdM1GKrPLXvCNo9IvBBkqJ2FvRjNdFf1yNwQo8LvD9 0ghw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689839705; x=1692431705; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aHFb36iaYbmIQpiaPjY1UsgrNY9Yir9dWsTpsYfsO/Y=; b=eH+sMP1eYZ3FnYSLy54X0ijI5LAS7nkNQX3p/kZsU6DsvtMvnJgw0DOTr7QuYzgEpx zn2mjdywFafuYfoYbme6rTb1lmWWQe8NwKg147LuFY6LO8msUiT0d9HG7UJTcXgnYQd5 mtRxzIfzQovv0dQ0xJ6Cl4atfvwEDtoQTbZu2OvAoq6DTUxMt0eLgf7SqmDjZ7qqNopy JW2bWwIXoJNubjhG0vYkAL9a3TYnEN0nXvt3ICvxkjL4/V99g8wL2TvZu3rRdJBoL2My otwyI8cqKarXGR6c6cm5GKegcvd6s5utw1bL6fKn08gsDxo9BZuRWnFsB4IdFU2+wAWL xKKQ== X-Gm-Message-State: ABy/qLaBK9VTh+0zPRIV0auvP3QEdKw6Anwo9kPf1PLIo6AjEoymxn3a a6Es+6vGebjxlzfDoJBwcDH3GSTFE8b4GmT6VERDsg== X-Google-Smtp-Source: APBJJlHu9ulUHUn1s+ZKubnNUSYxo9LVzXPP42dxf6KOMU2NhlqVM9AN85wAjF4ioyRYLg5xhwF/BPR+nRLbLykBBp0= X-Received: by 2002:a17:906:7e5a:b0:974:55a2:cb0b with SMTP id z26-20020a1709067e5a00b0097455a2cb0bmr3828672ejr.55.1689839704756; Thu, 20 Jul 2023 00:55:04 -0700 (PDT) MIME-Version: 1.0 References: <20230713042037.980211-1-42.hyeyoo@gmail.com> <20230720071826.GE955071@google.com> In-Reply-To: <20230720071826.GE955071@google.com> From: Yosry Ahmed Date: Thu, 20 Jul 2023 00:54:28 -0700 Message-ID: Subject: Re: [RFC PATCH v2 00/21] mm/zsmalloc: Split zsdesc from struct page To: Sergey Senozhatsky Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, Minchan Kim , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Mike Rapoport Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Stat-Signature: j5bpkz4demj9fnx51sbb6d567ynggfja X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 8FC962000A X-HE-Tag: 1689839706-106233 X-HE-Meta: U2FsdGVkX1/1MGiTux3bBmtqfzZeEs+LONakyxFARa1PQFUxo9+FvMvKfwQuoLa6VAjJM6InDQFP8eTlI4iy8fQyzDxodUdCLsIPLrCarbxITiMX1c7YCe9QgbopRPyho0rJjIqqqczMW8EkIjQuy5ybB7H5gfrh+jv4IOzXgyJG3UYlVQnChL9Ip+6MMLOsX9D+uJbiV3B1+GXvbbA4KXK/2K+JrqkEZKg7E5ZdNxfjtdhzIJfPNkPwg4wgH5kCbyuxNwJKGLz9b4m+tBAbMYj0MJtd667PDf37cpAlBolBty6BU0l6sNk+QmITwCucmmTDStFYVtk3MLRvTsITkGHKDMVcziZjo1l4G8zKsEk5YX5RNOKCCMRsxOUEOCLd+E/oAdYX4EKur9ZQgY7dGeyCbTWsvcHfira4qksF4uAYapHSzfFZWFIIw2cQBkxHLrasDcG3zZG5qgzXiIuvRgHT+63nODhktaSfRVGjxKsI5CKHKcLFmUjT8u92dBrAaIERU7xBOJ0lH0oX8cP8Dm9qOfxxzPwpdd4Sgg+qQs4v9kbkPFhUW418LPhka9SL/vGaMlNlahGrFdljHM4KCT1eojEsn8ifauC+cLHnrLZdGvcaWWh76FTdxS01XQ2whM+0j4JK+XXYAvicJBI/gKfoahKa7F38VYXyaOAfwdu7NVqKlarZd7rsfeRxbkmZ8kvB6GZoRalcTyIim+6ahaJilA0hlM0e5OkbWQc4j5SnGT0iPSn8cC3vzA3+GIr7bs2TSyRtFvNZEqCuVwxLewPqEgPmprw38rD83hPzgMWIabcKOC++gUWh9I9b06Zjit0pYu1x7hYGHffHxav3JDEwGtF6fKluESgWbgwiuKhlumLsMZoSgFL3+51HWMRzYPQnGujljTqPz8mXhFR0jMDpPF/eZcU/jTKfmo6gU2xExdk6jT6UCX1vJFdAEnlLyVjYDsEGqQYPysDu73f in3Mr9I+ 62dUtEptukVzz7oD8Rzm9jgRwbfk4h1zCWICbR/abBetAjlvcNxABdiySJQ+kBL4bqCMnDBcamjYbTrT/pvR+R3/6X/lzrEnVDe1KkdUI/wtlO0kaKnNmaLhBG0WuPNkyCYBaEvYLKAu6J1Zy17E7PypM3eIVP1BnqNSFn/NWNi8xHVgjDN/W4r7mBjW9lIM2HpW4VOa17efe30A5S3Ezq+j3lyLeLRRO+9kLXhxcnSgO86JYTVAxWplyIu3jQZkMz7gzzWoiVa8wqMt+oXwiPQviltcaeFAO/0O1qY2v73w6RswdYviCSqhCsGwh1xmlgO0Dwjz2T96EXz3XR+2UBL8aORNBVz7evZgc6m7bcvHBrqc= 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: On Thu, Jul 20, 2023 at 12:18=E2=80=AFAM Sergey Senozhatsky wrote: > > On (23/07/13 13:20), Hyeonggon Yoo wrote: > > The purpose of this series is to define own memory descriptor for zsmal= loc, > > instead of re-using various fields of struct page. This is a part of th= e > > effort to reduce the size of struct page to unsigned long and enable > > dynamic allocation of memory descriptors. > > > > While [1] outlines this ultimate objective, the current use of struct p= age > > is highly dependent on its definition, making it challenging to separat= ely > > allocate memory descriptors. > > I glanced through the series and it all looks pretty straight forward to > me. I'll have a closer look. And we definitely need Minchan to ACK it. > > > Therefore, this series introduces new descriptor for zsmalloc, called > > zsdesc. It overlays struct page for now, but will eventually be allocat= ed > > independently in the future. > > So I don't expect zsmalloc memory usage increase. On one hand for each > physical page that zspage consists of we will allocate zsdesc (extra byte= s), > but at the same time struct page gets slimmer. So we should be even, or > am I wrong? Well, it depends. Here is my understanding (which may be completely wrong): The end goal would be to have an 8-byte memdesc for each order-0 page, and then allocate a specialized struct per-folio according to the use case. In this case, we would have a memdesc and a zsdesc for each order-0 page. If sizeof(zsdesc) is 64 bytes (on 64-bit), then it's a net loss. The savings only start kicking in with higher order folios. As of now, zsmalloc only uses order-0 pages as far as I can tell, so the usage would increase if I understand correctly. It seems to me though the sizeof(zsdesc) is actually 56 bytes (on 64-bit), so sizeof(zsdesc) + sizeof(memdesc) would be equal to the current size of struct page. If that's true, then there is no loss, and there's potential gain if we start using higher order folios in zsmalloc in the future. (That is of course unless we want to maintain cache line alignment for the zsdescs, then we might end up using 64 bytes anyway).