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 F1C4CC00140 for ; Mon, 15 Aug 2022 17:47:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 511806B0073; Mon, 15 Aug 2022 13:47:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C1506B0075; Mon, 15 Aug 2022 13:47:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3884B8D0001; Mon, 15 Aug 2022 13:47:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 293B96B0073 for ; Mon, 15 Aug 2022 13:47:19 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id DB005140498 for ; Mon, 15 Aug 2022 17:47:18 +0000 (UTC) X-FDA: 79802558556.24.AFE3676 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by imf28.hostedemail.com (Postfix) with ESMTP id 3365DC01B2 for ; Mon, 15 Aug 2022 17:47:18 +0000 (UTC) Received: by mail-qk1-f174.google.com with SMTP id b2so6039044qkh.12 for ; Mon, 15 Aug 2022 10:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=Kk1le+XvE3D7VTktFKWjawEbexVd49xc8A2KpMO7iq8=; b=eQKsJ8stLgyyQXvUP/E7q4Wlp+v19noK96fAZX3mr1P14cj6AK0dtNCRHwiSjq8W1l F8ZvkF96Q5GjKKQVwJmHra/4F8MrB1pugUURKfQIqnqMjnOPth5Dp4M5Uff4f3gq6qYY 3vtXQk1lAyet/XMy+J3dj6NBxEc9umEp/KX4uUH8ncLTYut8nnYwzxnMWSZIK0ndAXUh IR6I2kwQxzUoxKaGK3s2qONIQKu4KpEBk4MvJ8tcq+A8apZYOV1GBg2xwo7n9eamEnd+ 2qSM2leEG3F8LydH6TQ7qn3yJR4IY11gT6d+X8TAgKKmaTZ7RMFCdgvCO6u+ocW8oaqL ajTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=Kk1le+XvE3D7VTktFKWjawEbexVd49xc8A2KpMO7iq8=; b=yz/dQSxdeMPcQfUUtkb6+Ag8VofSg80myuBynLQNmhjlbXvWpPGP4z3E9qMejTwbKs DUTydK1mL286B+FaFmzs6fKUxnqpViutOWjGQH2VW95kBV6dkxrpHPqBxpjzDr7WlDR7 oB+UvNKWodABcAgynuLwakDGVXmixxw2XBMQH9GPSDV2p1V+fq8nzofY4nlhvZpqwwur mKR1MdwqJ2H3mI4WPAyBZmTAtCwu5zEAvAooIm1r9RXBpyai589b5B8x5+07AORsxclO SR4os7PR8bM4vA99jGnHvWNNcsezp236kOW4/qi7tQkMwOM2J7V3gGj02E+pqzwafx6s X2uw== X-Gm-Message-State: ACgBeo0DCCdzViV4zqLxVjhFYbbQRIzrmfscppXQjifbVB6kUeMTAc6Z pyOzv8zj/o9AfmpASHPFOuY/0g== X-Google-Smtp-Source: AA6agR5gyGmmvLQOzu94ClYMxnOheRicWl4RTmWep+ox0M3u1C8LTRBWcfDQNLeGag4zBRQQV+arug== X-Received: by 2002:a05:620a:2545:b0:6b6:6773:f278 with SMTP id s5-20020a05620a254500b006b66773f278mr12704133qko.390.1660585637278; Mon, 15 Aug 2022 10:47:17 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::a23e]) by smtp.gmail.com with ESMTPSA id l3-20020a05620a28c300b006bb2661f3fasm4125935qkp.133.2022.08.15.10.47.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 10:47:16 -0700 (PDT) Date: Mon, 15 Aug 2022 13:47:15 -0400 From: Johannes Weiner To: Yosry Ahmed Cc: "Li,Liguang" , Shakeel Butt , Andrew Morton , Linux-MM , Cgroups , Michal Hocko , Muchun Song , Roman Gushchin Subject: Re: [PATCH] mm: correctly charge compressed memory to its memcg Message-ID: References: <1704B09B-F758-47DF-BDDE-FEA9AB227E12@baidu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660585638; a=rsa-sha256; cv=none; b=nUGDQyBELGNdKdSzbJb5H1qV9WKJkjlcbcV97GF3kun97eyQlzC9Y7F1U3R28yoZ8yeNf+ wzOZn1CMQ12DOy7Sw3E9PAGpka7HEArXUmodVu486FshMP6eRxIH8jO1H3sLiZjXNViJQJ pxJD1PACsINXjEiO7idpS8xqpvqHPUo= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=eQKsJ8st; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf28.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.174 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660585638; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Kk1le+XvE3D7VTktFKWjawEbexVd49xc8A2KpMO7iq8=; b=2MszGOo1q23fn5G18gm8PkxB7Y4MuDJF85p7pa1KjUhLqFh1ghstUWzajOFf7m5Fphjm+P 8Q6liNlyMQaKKLMlkUuJO7OGRZIKma1ILh20VmYDru2W3qNHjwQM+fZyJHBpeozkB3kxwZ GbCzBPdcmU+bnpJyCL6K1WOSd/EPYvA= X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3365DC01B2 X-Rspam-User: Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=eQKsJ8st; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf28.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.174 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org X-Stat-Signature: w5hneunr73buebd5ufdgz3paw8p3ascc X-HE-Tag: 1660585638-398427 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 Mon, Aug 15, 2022 at 09:16:08AM -0700, Yosry Ahmed wrote: > On Mon, Aug 15, 2022 at 8:42 AM Yosry Ahmed wrote: > > > > On Mon, Aug 15, 2022 at 8:31 AM Johannes Weiner wrote: > > > > > > On Mon, Aug 15, 2022 at 06:46:46AM -0700, Yosry Ahmed wrote: > > > > Yeah I understand this much, what I don't understand is why we charge > > > > the zswap memory through objcg (thus tying it to memcg kmem charging) > > > > rather than directly through memcg. > > > > > > The charged quantities are smaller than a page, so we have to use the > > > byte interface. > > > > > > The byte interface (objcg) was written for slab originally, hence the > > > link to the kmem option. But note that CONFIG_MEMCG_KMEM is no longer > > > a user-visible option, and for all intents and purposes a fixed part > > > of CONFIG_MEMCG. > > > > > > (There is the SLOB quirk. But I'm not sure anybody uses slob, let > > > alone slob + memcg.) > > > > Thanks for the clarification, it makes sense to use the byte interface > > here for this, and thanks for pointing out that CONFIC_MEMCG_KMEM is > > not part of CONFIG_MEMCG. > > > > One more question :) memcg kmem charging can still be disabled even > > with !CONFIG_MEMCG_KMEM, right? In this case zswap charging will also > > be off, which seems like an unintended side effect, right? > > memcg kmem charging can still be disabled even > with CONFIG_MEMCG_KMEM*** Yes, indeed, if the host is booted with the nokmem flag. Doing so will turn off slab, percpu, and (as of recently) zswap. The zswap backing storage *is* kernel memory, so that seems like the correct semantics for the flag. That said, the distinction between kernel and user memory is becoming increasingly odd. The more kernel memory we track, the more ridiculous the size of the hole you punch into resource control by disabling it. Maybe we should just deprecate that knob altogether.