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 B6311E810DA for ; Wed, 27 Sep 2023 12:50:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1B6BC6B017C; Wed, 27 Sep 2023 08:50:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 140566B017D; Wed, 27 Sep 2023 08:50:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F23986B0180; Wed, 27 Sep 2023 08:50:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id DE5FB6B017C for ; Wed, 27 Sep 2023 08:50:15 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B2B9514045E for ; Wed, 27 Sep 2023 12:50:15 +0000 (UTC) X-FDA: 81282360390.04.5AD86DC Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf13.hostedemail.com (Postfix) with ESMTP id C966520028 for ; Wed, 27 Sep 2023 12:50:13 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=ha5j+hIP; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf13.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 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=1695819014; 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=sxBrZrM5hfLMtTNxf05EQ6NAFimmP4KyNoHJGo1kqN0=; b=ok9oT1WJkQyF8MwQIxYiFqkgS++rxlZ+AG8Zq+ZZ+DHjlv4Fk+hir62FPqaSGhXW0LB7AY b46zJx3iDelR3uK3t9sGmDw5YMKubFUddWOsjBL6wXDo2a4WknQcs77Cmg/n3eZWRdc6YA F0qCmxG9jVuWhzh1xejTru98m9C4EmI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=ha5j+hIP; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf13.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695819014; a=rsa-sha256; cv=none; b=aKnx6ZR4pXdxSMlXJyMbTmCxMfkbrpMXUHOiOT9UpKIa13gAp0L7vYNS02E4YtsD03W1ri em0V9nO3VijkezPf8IowGfb/9wPCIiD0+fWeN3mIqwt6O4hrM3CS+kPlOti0SDutieWpnn HZGb7tYxoP2lfEkfEomPidDo5tcjsT8= 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-out2.suse.de (Postfix) with ESMTPS id 9FBB21F88F; Wed, 27 Sep 2023 12:50:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1695819011; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=sxBrZrM5hfLMtTNxf05EQ6NAFimmP4KyNoHJGo1kqN0=; b=ha5j+hIPJJ6lzadvIMzHzoUW9ZmC8K3jQOxjwaKXmEkAfeXbnpPmsbHta9tiU7K/w0b8Oh PnKfqQ+t4CgjfFCOS6eG4gPP4VDLeeGDugFGPJTHutWqYgqXmqmjXqkKfOpCLJ2cdIHLC8 lnH9MOkZuIPUnbf7nXqL0+AxscBsCY8= 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 7C12D13479; Wed, 27 Sep 2023 12:50:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id tPV9GwMlFGXVCwAAMHmgww (envelope-from ); Wed, 27 Sep 2023 12:50:11 +0000 Date: Wed, 27 Sep 2023 14:50:10 +0200 From: Michal Hocko To: Johannes Weiner Cc: Frank van der Linden , Nhat Pham , akpm@linux-foundation.org, riel@surriel.com, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, tj@kernel.org, lizefan.x@bytedance.com, shuah@kernel.org, mike.kravetz@oracle.com, yosryahmed@google.com, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH 0/2] hugetlb memcg accounting Message-ID: References: <20230926194949.2637078-1-nphamcs@gmail.com> <20230926221414.GD348484@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230926221414.GD348484@cmpxchg.org> X-Rspamd-Queue-Id: C966520028 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: zg6r4y5pnorn4wmqyrnr7n5fo5358d71 X-HE-Tag: 1695819013-925903 X-HE-Meta: U2FsdGVkX1+QS1x/hosdGpefaPr1M3W8epHGsDatbMJAj5j83D14xAt43gwovBtmk0f37G/SWwW9/Hqj+KKdRlIujbKNZSnJBqPb6lQzYkgbd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-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue 26-09-23 18:14:14, Johannes Weiner wrote: [...] > The fact that memory consumed by hugetlb is currently not considered > inside memcg (host memory accounting and control) is inconsistent. It > has been quite confusing to our service owners and complicating things > for our containers team. I do understand how that is confusing and inconsistent as well. Hugetlb is bringing throughout its existence I am afraid. As noted in other reply though I am not sure hugeltb pool can be reasonably incorporated with a sane semantic. Neither of the regular allocation nor the hugetlb reservation/actual use can fallback to the pool of the other. This makes them 2 different things each hitting their own failure cases that require a dedicated handling. Just from top of my head these are cases I do not see easy way out from: - hugetlb charge failure has two failure modes - pool empty or memcg limit reached. The former is not recoverable and should fail without any further intervention the latter might benefit from reclaiming. - !hugetlb memory charge failure cannot consider any hugetlb pages - they are implicit memory.min protection so it is impossible to manage reclaim protection without having a knowledge of the hugetlb use. - there is no way to control the hugetlb pool distribution by memcg limits. How do we distinguish reservations from actual use? - pre-allocated pool is consuming memory without any actual owner until it is actually used and even that has two stages (reserved and really used). This makes it really hard to manage memory as whole when there is a considerable amount of hugetlb memore preallocated. I am pretty sure there are many more interesting cases. -- Michal Hocko SUSE Labs