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 ED7A8C00140 for ; Fri, 12 Aug 2022 21:56:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F22488E0001; Fri, 12 Aug 2022 17:56:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ED13A6B0075; Fri, 12 Aug 2022 17:56:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D99818E0001; Fri, 12 Aug 2022 17:56:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C73E06B0073 for ; Fri, 12 Aug 2022 17:56:29 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 94EB7141D10 for ; Fri, 12 Aug 2022 21:56:29 +0000 (UTC) X-FDA: 79792300098.15.94BA5A7 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf08.hostedemail.com (Postfix) with ESMTP id 503A416005F for ; Fri, 12 Aug 2022 21:56:28 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id m2so1828829pls.4 for ; Fri, 12 Aug 2022 14:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=o2hp/mCYv88Mu5Svxez+bwRchvdFYkFYWfUz+bymVnc=; b=q1jKUnyVZ9vO4CNzKCvW4vPDrvisSyGyG/aj2uv3JTpY33zTgaWK4E20HV+lY9mCRW NAQfFUw/KuEcyS66BsOz17ZF45PP3LT9pkwMDyCAQUvMFTOxZ21/n6yfZ90uGfu3lwDB Z5zVIcCxdviScscBaVZGTwL8svQwie4johmolE7J6EJcwLeQBarQM4aM6sUiR/DelNuu bHEwrLxWqs9KOD/3WF1o59D7PyuzMsPWE6RCFtCofmK7NBHMRlQwmiZBo8Lgr5syF5gu gPd3ia9znghXyZh726OwhHTlQ1ItRFVZ7GLkXtsfn/K9oo5jjtEYPZ8gJxmMIvDK60nN e2tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=o2hp/mCYv88Mu5Svxez+bwRchvdFYkFYWfUz+bymVnc=; b=IiksLghWd+Sm7++7zSnCP4qc9XulmWnCKdwxhbShg3D6IZ79d75CqJdVRnv/Irbra5 NOuyWlH7EvqpxVsh6w76EyudpHuLH/5HrkspfGKjscfc1S5FLM6RYES7bIufPYt9p63K mc18lXriUcbgl5GrT6u1SeY7eyIozzY1+is4alJ6BfUjP+39K/OkhZFGAmubeghSyIoW L2IwoQkQ8xOsf4eaZ6Udloe4GIig+tlJqjWEAMsTyO+YYhkx+P6jasirPi67G8DBxBcW dg51LO/o3X/hxQ12MJHuPgUY7zr5u1xLDcxPoU5RGe+oB9JRWQJJhtq3iD2DrXXlzadx vWYQ== X-Gm-Message-State: ACgBeo3WE2YBVDqLvYCSWjdCJM0fLe7Q7tCYCqStGkAm059mv4oDGvLj c1dQf1CeS644tgobjWuSGU+fuRW0VYAyaBxj0ExahQ== X-Google-Smtp-Source: AA6agR7CaCJ5Vsb+sflEr2xgVLmweZ/8QQk5Z3RU9GdOB8/kb7LUVTxvnXAI5HxPZ3P+TQoRrjRqN+hPLJuBzp1N8D4= X-Received: by 2002:a17:902:8683:b0:171:3114:7678 with SMTP id g3-20020a170902868300b0017131147678mr5936618plo.172.1660341387154; Fri, 12 Aug 2022 14:56:27 -0700 (PDT) MIME-Version: 1.0 References: <20220811081913.102770-1-liliguang@baidu.com> In-Reply-To: From: Shakeel Butt Date: Fri, 12 Aug 2022 14:56:16 -0700 Message-ID: Subject: Re: [PATCH] mm: correctly charge compressed memory to its memcg To: liliguang , akpm@linux-foundation.org, linux-mm@kvack.org Cc: cgroups@vger.kernel.org, hannes@cmpxchg.org, mhocko@kernel.org, songmuchun@bytedance.com, Roman Gushchin Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660341388; 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=o2hp/mCYv88Mu5Svxez+bwRchvdFYkFYWfUz+bymVnc=; b=jWeu/jz901znqB8e9YYvSOMVfmWEXO19JNjQ1Y9fnRSjTRBqFnVhtj2igSl9Awc6p+7kSh k4tkVjDAunD+PMjZqF9JsxM4tt9r53VF4AfK/dpLrQuMRlUVjxOuTz/bcCI/RcuUizDCik 6R7PqAOV92ic96SEWgFk6Gl7CMl7S+o= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=q1jKUnyV; spf=pass (imf08.hostedemail.com: domain of shakeelb@google.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=shakeelb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660341388; a=rsa-sha256; cv=none; b=s41mRn3ggo9bfXXD/dUurAoyv+Zlpfdl98DMcsgU2cNQMUZ0Vn7+4r4VkA+OeNtr1tsMNj jStgHn8dnn17KVGazjz48YnSjeMIUFpxXqDUifGnlZmhB0gHCEn/naVfekMIiRG8KIT3tz lMgA0dIQ+Spmpm2FXsyC/UrBAz2t4po= X-Stat-Signature: 35jgcred9omuhsfnqra1kx1ctxj6wqds X-Rspamd-Queue-Id: 503A416005F Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=q1jKUnyV; spf=pass (imf08.hostedemail.com: domain of shakeelb@google.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=shakeelb@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1660341388-33211 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: +Andrew & linux-mm On Thu, Aug 11, 2022 at 5:12 PM Roman Gushchin wrote: > > On Thu, Aug 11, 2022 at 04:19:13PM +0800, liliguang wrote: > > From: Li Liguang > > > > Kswapd will reclaim memory when memory pressure is high, the > > annonymous memory will be compressed and stored in the zpool > > if zswap is enabled. The memcg_kmem_bypass() in > > get_obj_cgroup_from_page() will bypass the kernel thread and > > cause the compressed memory not charged to its memory cgroup. > > > > Remove the memcg_kmem_bypass() and properly charge compressed > > memory to its corresponding memory cgroup. > > > > Signed-off-by: Li Liguang > > --- > > mm/memcontrol.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > index b69979c9ced5..6a95ea7c5ee7 100644 > > --- a/mm/memcontrol.c > > +++ b/mm/memcontrol.c > > @@ -2971,7 +2971,7 @@ struct obj_cgroup *get_obj_cgroup_from_page(struct page *page) > > { > > struct obj_cgroup *objcg; > > > > - if (!memcg_kmem_enabled() || memcg_kmem_bypass()) > > + if (!memcg_kmem_enabled()) > > return NULL; > > > > if (PageMemcgKmem(page)) { > > -- > > 2.32.0 (Apple Git-132) > > > > Hi Li! > > The fix looks good to me! As we get objcg pointer from a page and not from > the current task, memcg_kmem_bypass() doesn't makes much sense. > > Acked-by: Roman Gushchin > > Probably, we need to add > Fixes: f4840ccfca25 ("zswap: memcg accounting") > > Thank you! You can add: Acked-by: Shakeel Butt From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shakeel Butt Subject: Re: [PATCH] mm: correctly charge compressed memory to its memcg Date: Fri, 12 Aug 2022 14:56:16 -0700 Message-ID: References: <20220811081913.102770-1-liliguang@baidu.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=o2hp/mCYv88Mu5Svxez+bwRchvdFYkFYWfUz+bymVnc=; b=q1jKUnyVZ9vO4CNzKCvW4vPDrvisSyGyG/aj2uv3JTpY33zTgaWK4E20HV+lY9mCRW NAQfFUw/KuEcyS66BsOz17ZF45PP3LT9pkwMDyCAQUvMFTOxZ21/n6yfZ90uGfu3lwDB Z5zVIcCxdviScscBaVZGTwL8svQwie4johmolE7J6EJcwLeQBarQM4aM6sUiR/DelNuu bHEwrLxWqs9KOD/3WF1o59D7PyuzMsPWE6RCFtCofmK7NBHMRlQwmiZBo8Lgr5syF5gu gPd3ia9znghXyZh726OwhHTlQ1ItRFVZ7GLkXtsfn/K9oo5jjtEYPZ8gJxmMIvDK60nN e2tQ== In-Reply-To: List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: liliguang , akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org, mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org, Roman Gushchin +Andrew & linux-mm On Thu, Aug 11, 2022 at 5:12 PM Roman Gushchin wrote: > > On Thu, Aug 11, 2022 at 04:19:13PM +0800, liliguang wrote: > > From: Li Liguang > > > > Kswapd will reclaim memory when memory pressure is high, the > > annonymous memory will be compressed and stored in the zpool > > if zswap is enabled. The memcg_kmem_bypass() in > > get_obj_cgroup_from_page() will bypass the kernel thread and > > cause the compressed memory not charged to its memory cgroup. > > > > Remove the memcg_kmem_bypass() and properly charge compressed > > memory to its corresponding memory cgroup. > > > > Signed-off-by: Li Liguang > > --- > > mm/memcontrol.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > index b69979c9ced5..6a95ea7c5ee7 100644 > > --- a/mm/memcontrol.c > > +++ b/mm/memcontrol.c > > @@ -2971,7 +2971,7 @@ struct obj_cgroup *get_obj_cgroup_from_page(struct page *page) > > { > > struct obj_cgroup *objcg; > > > > - if (!memcg_kmem_enabled() || memcg_kmem_bypass()) > > + if (!memcg_kmem_enabled()) > > return NULL; > > > > if (PageMemcgKmem(page)) { > > -- > > 2.32.0 (Apple Git-132) > > > > Hi Li! > > The fix looks good to me! As we get objcg pointer from a page and not from > the current task, memcg_kmem_bypass() doesn't makes much sense. > > Acked-by: Roman Gushchin > > Probably, we need to add > Fixes: f4840ccfca25 ("zswap: memcg accounting") > > Thank you! You can add: Acked-by: Shakeel Butt