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 4436BEB64DB for ; Thu, 15 Jun 2023 13:27:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD0D86B0072; Thu, 15 Jun 2023 09:27:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A80896B0074; Thu, 15 Jun 2023 09:27:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 96F0B8E0001; Thu, 15 Jun 2023 09:27:51 -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 8AEF66B0072 for ; Thu, 15 Jun 2023 09:27:51 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 511C5C0859 for ; Thu, 15 Jun 2023 13:27:51 +0000 (UTC) X-FDA: 80905059942.13.5CF2108 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf23.hostedemail.com (Postfix) with ESMTP id 4C15F140024 for ; Thu, 15 Jun 2023 13:27:49 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="Y5h0z/hT"; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf23.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686835669; 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=q6M/NGzKcM2Cg/a0sn3th6RfR3GtPwRmYrlgmNE+Q8A=; b=YhCwKNKgS3ZO6wuC3pj8NHj6ISFvJzUzNpOtpyVIXC5Glv6ACYkz7WO9Mo9a3uSsueQxxa t/+dR3mpu1YVViLJZ3TKzpjVRnSrmsfCJYEKbl0OcYMIKc3cS1TuL6f78Xnp49A9sRa4YL FqRG9jOfv2mmvqjsKlwy0Emb0uJdwus= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="Y5h0z/hT"; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf23.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686835669; a=rsa-sha256; cv=none; b=20nLqgbnRS5G1c6ocZTXcGi72B3wluTxgoPTrQbzOei392i27c97VQW8Ta+FAtoIAjpyrj nAnlvCsI062mRAg0wfCMoeucFrA8/UYQbBvpCNWndPhgTT+nk6AFIeTDubV6mLr+SWfFIq By3ZS7MrTkbIlpTnRlsiesxHUnZpeAQ= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A40632240D; Thu, 15 Jun 2023 13:27:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1686835667; h=from:from:reply-to: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; bh=q6M/NGzKcM2Cg/a0sn3th6RfR3GtPwRmYrlgmNE+Q8A=; b=Y5h0z/hTNEHIiireJfIQl6qaCjSzs4HVZb7PQNpR//Jq9HqdYjzqravUV7pA+9wNDAiNy1 JhIPKddR5ASYe7kXxoIpd+1Kz8+RsnesRz3iRZcOqDnH3rvSBXsldrkms02We7qgXKWt+l 6fNVh9sG28oGfCYURizPEhLXtJ2AciA= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8FB1113467; Thu, 15 Jun 2023 13:27:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 0VTvIdMRi2R7VAAAMHmgww (envelope-from ); Thu, 15 Jun 2023 13:27:47 +0000 Date: Thu, 15 Jun 2023 15:27:47 +0200 From: Michal Hocko To: =?utf-8?B?6LS65Lit5Z2k?= Cc: minchan@kernel.org, senozhatsky@chromium.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [External] Re: [RFC PATCH 1/3] zram: charge the compressed RAM to the page's memcgroup Message-ID: References: <20230615034830.1361853-1-hezhongkun.hzk@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4C15F140024 X-Stat-Signature: w5i9cuo35r5gk44gj184kw5crybsg9b4 X-Rspam-User: X-HE-Tag: 1686835669-23761 X-HE-Meta: U2FsdGVkX1+8zPyb8y2i2lUx/OD7wrDH27LdDNPpKaxRRaZO0eVB8iYiCnG5EUOd8kk0Ix9p47i/o6eJQcIJFSRB6vLK9Z6JMXSDIs3eGu+yMKTSp99jmj0QKVm5vqVS/xvLLJSyp5NU/QPScjX7QgQz3Sl0r7sRn3o29hKSWEdjDX2hfPzNademXm/qAnMs4mJExCsJ3m66PPEoerIzd1HlW2BxYoej8Af9hmIfbjeV64m9QVxbNUH+Z4ACMIdYcXKPQqrzkJX0DEK15IDGqtHvuVflVHeFGTIQovnymoB0O2oevW9KNG/s6fMX9FW3Ejlgjx75IbAQxN5sNM6Njm+6mZamcI6MEX1qC7wNBXDj6bsBaKxHRoQ+Klr7V4sGrIoq8m9CIkdi4g5CtM/lbiSXKV8h4aQKf8EnBI4ar4mjA06ZGn2f/YJIJafoyHpHYXPBIgIT1WIsSiyZrtEWqtrTt2rjf+J2UEwQO99eiUt81CJl+RKcUtr4GNTzB/nL9nenk5wdO6LuqZHpjtlNAK63DYuh9tFdF7YZ8LkM92YrLh39gooWUnjjPRBOY7MMxuKt4BYHcIff5HlqlLuCHw41IzFAzYSVEz0BOfLksjoNZhWBa5Cp0gEnBRc3fIDAbBByG+T5GWt3JDyT1bSqa+1CYs+lERJhByWIuqTuVGC2h4wqfiwP3oxbvsgA9eEBJx26m0ABBvm1IplxNzF7po+AJU+1NUg9qXlgQxauSP8x6G98QMjv/yFDb0CfXN9Mfk+sPAKW4z345EJYO6oBM1qV16UGOBgzalICC1BbGkeY75ukLdVXfUgNfm5kc8NcZzu1NmD5TgKOW23saSajsBhyEEnk3vfJK4N39zqAHf7SFhLCyyzcQsbsQoHgYaHS6+hNC2opw1Mahfd5k0YlbH4oaZDHYhsQAIF1ZbXoonlYMyD9yyV2Ik6N0+EJKlhq9P6H5g4cWguUlx2iY+P 0ekWo5gj mMbMs3NDhY8aXoMtb/wYu4rLWHhE2Gsxz6FrDj1E2JDoxXkIqucOkPr+i11shJKoVM0R9ysQYkkas+at0Utks7XR7WG9+PfW1t4ZScjLEo4dTzSCgKeyLZac8dxo0qZM/9UTglxCIfnke3E8y1gABbRtxKg== 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 15-06-23 21:09:16, 贺中坤 wrote: > > Let me check I understand. This patch on its own doesn't really do > > anything. You need the zs_malloc support implemented in patch 3 for this > > to have any effect. Even with that in place the zs_malloc doesn't follow > > the __GFP_ACCOUNT scheme we use for allocation tracking. Correct? > > > > Yes, I will use it on next version. OK, also make sure that the zsmalloc support is implemented before zram depends on it. > > I do not think this is answering my question. Or maybe I just > > misunderstand. Let me try again. Say you have a memcg under hard limit > > pressure so any further charge is going to fail. How can you reasonably > > implement zram back swapout if the memory is charged? > > > > Sorry, let me try to explain again. I have a memcg under hard limit pressure. > Any further charge will try to free memory and swapout to zram back which > is compressed and stored data in memory.so any further charge is not going > to fail. The charged memory is swapout to compressed memory step by > step, but the compressed memory is not charged to the original memcgroup. > So, Actual memory usage is already greater than the hard limit in some cases. > This pachset will charge the compressed memory to the original memcg, > limited by memory.max This is not really answering my question though. memcg under hard limit is not really my concern. This is a simpler case. I am not saying it doesn't need to get addresses but it is the memcg hard limited case that is much more interested. Because your charges are going to fail very likely and that would mean that swapout would fail AFAIU. If my understanding is wrong then it would really help to describe that case much more in the changelog. -- Michal Hocko SUSE Labs