Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10104074rwp; Thu, 20 Jul 2023 14:51:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlFs1Kc6s0+tH8s9C8cxJXbyDwF4wcKA47iaqP5qgGX2Sy19yCHrDG4VR77r+13/MkOffvUs X-Received: by 2002:a19:670c:0:b0:4fb:8926:b137 with SMTP id b12-20020a19670c000000b004fb8926b137mr2428990lfc.33.1689889880829; Thu, 20 Jul 2023 14:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689889880; cv=none; d=google.com; s=arc-20160816; b=qwMnPZDFKS6gI/mVatayLCexvUDxcqq174i9x6PNycdjkrAuL9VdIbUUCVEHmwW6wJ DKzL5OMaSt/CmySkXUXe7K3lxr8HXhuuVoFgLnTqgdcQ1UDyscduW/DeQeP9dzIwUtd7 VnXziFTrmkq3fk3pyNg1PTbT6PlU++P679oTY3bsU0TC3TZITzLYKSLU0Wiw3B8bLaia Okq4Zrcvmrrb8Ztu9irMwi41MC+L9o6+l9KY/LvoTofEq5YBCLTDE3XFnXc7IrN6/Hvw lirL16z9nYaaUEXAM+ALfPlO0luqOCLnjgB71BRXSuwuClrBLCH9PzPuroJYT9bBK167 QhRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=xQU5ilzcOlx1ker9FtySpdRzva8lrA7ZPN1m8QAc4bs=; fh=QA9IEJmI26vM+HS6Qe5aizkIeYxIa5b+fSfN38xaPrA=; b=F6yp9/FoBPOOgsbTfN9p2uWLxtB9MzQ3mFj+TIei3XRMTh3qdZE/gbDxvCnJncuYh/ JWWngT4+HSmNKFEKshKeSkzw0u6OLZW0cGaqlRchVgPvtpIscfiytF7rfAMXjHXP3EjH SP1L9vYGwOOLc84Rz7Yatmr8kPX/rXdtbG8Uzrrwc9/utu/geZ7FfTJo1/qS2MQt88fU jcze7otrPNnLkTSnJ6jF2Fe3/YSMOtWECtkHcTYujsDRiimsI2VCHbgbHrd2qP/7Hg/k uBhFjqX3dKs1FCj2eudHnYOA8Ao9mLrPmgu5IsM6PXXeYAFbNkBJD69ux74jFVc+YPLO CNlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=kApWVfk7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v17-20020aa7d651000000b005218c27b18csi1337964edr.498.2023.07.20.14.50.56; Thu, 20 Jul 2023 14:51:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=kApWVfk7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbjGTVjR (ORCPT + 99 others); Thu, 20 Jul 2023 17:39:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230200AbjGTVjO (ORCPT ); Thu, 20 Jul 2023 17:39:14 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88D842718 for ; Thu, 20 Jul 2023 14:39:10 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-992acf67388so185486766b.1 for ; Thu, 20 Jul 2023 14:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689889149; x=1690493949; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=xQU5ilzcOlx1ker9FtySpdRzva8lrA7ZPN1m8QAc4bs=; b=kApWVfk7mgCl3vz5Ks34PjDck0dcLfzryvNcDaqjJnMkjghZ5oWGDsCEc/ao3rre/Z Jdt2WbFSa0GjyRtPQsuWBQbrMofTViCueIJJ8NwHEf7hUAbR7knh77AhxDeySQRXM6Zt 3synq3Y/BGvqXj0u6r/OHrp2S9+PmXOs5WvLuirsre55+YMvlLmO1ApDM0OvpuBC3UBK aGTNEBGtoKrWlX9jkCPpkZZr6dW9pCRMvfWfwicy15H4IZR4GvUKe6WvyLmwSQdCNaPl mReDkJfjQmxbt+aAbnqqTjL3LtUuLI9RIvjbTdrbKL2z4INQd1/hGTT0vjsjTJ9c8yxJ cvjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689889149; x=1690493949; h=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=xQU5ilzcOlx1ker9FtySpdRzva8lrA7ZPN1m8QAc4bs=; b=fAtg4K52n7u4eMN8WPY9ipw1jYj8an+5E0aQuHWf4YVULzR8jn8ihtTh93kXzu/pce nGjAW/prE9nvZPd1Z++DG/8A2LXxeU9sgL/sqycV0juvhtrhFyCJpNRSqTZhuBJdSoko mRXyTIMOz4ITMIW4fM0OhEPrCneA9aY4u1EkbiyJnGrjzJVCfM9zUz+WmBryCVmDO7mc 1eYayKoc2eFEremfteVa303HzKd5u8FqGgR9WPWzkZcxJebrnX77c/BdapoPNOMY987r YvvRQVb7zrYT5sBwgUUe/0vVUINpGSJga6pVnYfeUXEoZXgOGmSPJ8ljjND+JY2waGOq Ituw== X-Gm-Message-State: ABy/qLaw7vE6lEzaK5c0AYSDEkXF0FugzUi5vwEDopXaevBKEjNVUbxm o39FfGxupvEP3GYX6D8RZEDjYOABZaNhSoFgRbeo+A== X-Received: by 2002:a17:907:b0a:b0:993:fa99:d7e2 with SMTP id h10-20020a1709070b0a00b00993fa99d7e2mr23601ejl.21.1689889148704; Thu, 20 Jul 2023 14:39:08 -0700 (PDT) MIME-Version: 1.0 References: <20230713042037.980211-1-42.hyeyoo@gmail.com> <20230720071826.GE955071@google.com> In-Reply-To: From: Yosry Ahmed Date: Thu, 20 Jul 2023 14:38:32 -0700 Message-ID: Subject: Re: [RFC PATCH v2 00/21] mm/zsmalloc: Split zsdesc from struct page To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Sergey Senozhatsky , Minchan Kim , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Mike Rapoport Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > > 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, > > > > > > Yeah, zsdesc would be 56 bytes on 64 bit CPUs as memcg_data field is > > > not used in zsmalloc. > > > More fields in the current struct page might not be needed in the > > > future, although it's hard to say at the moment. > > > but it's not a loss. > > > > Is page->memcg_data something that we can drop? Aren't there code > > paths that will check page->memcg_data even for kernel pages (e.g. > > __folio_put() -> __folio_put_small() -> mem_cgroup_uncharge() ) ? > > zsmalloc pages are not accounted for via __GFP_ACCOUNT, Yeah, but the code in the free path above will check page->memcg_data nonetheless to check if it is charged. I think to drop memcg_data we need to enlighten the code that some pages do not even have memcg_data at all, no? > and IIUC the current implementation of zswap memcg charging does not > use memcg_data > either - so I think it can be dropped. My question is more about the generic mm code expecting to see page->memcg_data in every page, even if it is not actually used (zero). > > I think we don't want to increase memdesc to 16 bytes by adding memcg_data. > It should be in use-case specific descriptors if it can be charged to memcg? >