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 C25AFE784AC for ; Mon, 2 Oct 2023 12:18:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E44B8D0022; Mon, 2 Oct 2023 08:18:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 292CF8D0001; Mon, 2 Oct 2023 08:18:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 10DB48D0022; Mon, 2 Oct 2023 08:18:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id F099B8D0001 for ; Mon, 2 Oct 2023 08:18:37 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C3D0F1A0248 for ; Mon, 2 Oct 2023 12:18:37 +0000 (UTC) X-FDA: 81300424674.05.D853D76 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf03.hostedemail.com (Postfix) with ESMTP id C39182002A for ; Mon, 2 Oct 2023 12:18:34 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=rfXoQ7EG; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf03.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=1696249115; 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=tIkc8wpprjvNQ6XbejVFpwUcXLgpsEm5O3FIVv9vWWY=; b=G41Uiuyh1a0uWdJzlWCXVR0enASAg0bjdv5mXR9DQWhgc3P01qsBr4mgc42Fui2OXtIsqd qUvvht63RTJEoC00eVK6J1VM6+pPjwyOKjqGLUhxSqQLEAqUl9Hv3G+98hdLsS0YHxrCXy SjX7TCnzJnJNjeG7QN23FGkKIh0CFeE= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=rfXoQ7EG; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf03.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=1696249115; a=rsa-sha256; cv=none; b=yRm89IqxUFkYxQ3OBEuo+edsa80wPczjkFA/JZTszreTIRpVrwtgl3yfLQ8lvbE2/oAuhG sG2fHK/eQIkfElea5A0IhNxAtHFH8ZoQEyHbROJkVsztDkFGkeK7AlHRcW7E0j6rKecPK1 yR4VyVDLTWYoW8NhOCBjleg7QAu5qqA= 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 75102210E0; Mon, 2 Oct 2023 12:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1696249112; 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=tIkc8wpprjvNQ6XbejVFpwUcXLgpsEm5O3FIVv9vWWY=; b=rfXoQ7EGE9+npzmoeY7FfpoViXbIdglWC3ICWGVjx/3rw1XLefZngDRsNdIa+6Mj7wVuzz cVELoJKQ+CkG5mxIb8kxE3JJByLldqwmyXk84eqH7BMRB1EN/2+nob4t45C/5qEJbd8Fpa lzMwdkSfEqPsh48il+pJrqXEh/Fg4+8= 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 4A5F013434; Mon, 2 Oct 2023 12:18:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gak4Dxi1GmVrIQAAMHmgww (envelope-from ); Mon, 02 Oct 2023 12:18:32 +0000 Date: Mon, 2 Oct 2023 14:18:31 +0200 From: Michal Hocko To: Johannes Weiner Cc: Yosry Ahmed , 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, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH v2 1/2] hugetlb: memcg: account hugetlb-backed memory in memory controller Message-ID: References: <20230928005723.1709119-1-nphamcs@gmail.com> <20230928005723.1709119-2-nphamcs@gmail.com> <20230929150829.GA16353@cmpxchg.org> <20230929174221.GA19137@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230929174221.GA19137@cmpxchg.org> X-Rspamd-Queue-Id: C39182002A X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 8yxqes9jkzbe6rh7tyd55nseqzkuz6kc X-HE-Tag: 1696249114-89341 X-HE-Meta: U2F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JvZn7a7ih6+0OMVIAF5GJ/uGlSmtNmTwIsmM9fAc64SEx6d4XOrOAdBe3dYEryJe26/C8dcdCUjIztgzicRjkCWot+mZQSPuwUODcppujzk7QfZXN+dQ== 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 Fri 29-09-23 13:42:21, Johannes Weiner wrote: > On Fri, Sep 29, 2023 at 08:11:54AM -0700, Yosry Ahmed wrote: > > On Fri, Sep 29, 2023 at 8:08 AM Johannes Weiner wrote: > > > > > > On Thu, Sep 28, 2023 at 06:18:19PM -0700, Yosry Ahmed wrote: > > > > My concern is the scenario where the memory controller is mounted in > > > > cgroup v1, and cgroup v2 is mounted with memory_hugetlb_accounting. > > > > > > > > In this case it seems like the current code will only check whether > > > > memory_hugetlb_accounting was set on cgroup v2 or not, disregarding > > > > the fact that cgroup v1 did not enable hugetlb accounting. > > > > > > > > I obviously prefer that any features are also added to cgroup v1, > > > > because we still didn't make it to cgroup v2, especially when the > > > > infrastructure is shared. On the other hand, I am pretty sure the > > > > maintainers will not like what I am saying :) > > > > > > I have a weak preference. > > > > > > It's definitely a little weird that the v1 controller's behavior > > > changes based on the v2 mount flag. And that if you want it as an > > > otherwise exclusive v1 user, you'd have to mount a dummy v2. > > > > > > But I also don't see a scenario where it would hurt, or where there > > > would be an unresolvable conflict between v1 and v2 in expressing > > > desired behavior, since the memory controller is exclusive to one. > > > > > > While we could eliminate this quirk with a simple > > > !cgroup_subsys_on_dfl(memory_cgrp_subsys) inside the charge function, > > > it would seem almost punitive to add extra code just to take something > > > away that isn't really a problem and could be useful to some people. > > > > > > If Tejun doesn't object, I'd say let's just keep implied v1 behavior. > > > > I agree that adding extra code to take a feature away from v1 is > > probably too much, but I also think relying on a v2 mount option is > > weird. Would it be too much to just have a v1-specific flag as well > > and use cgroup_subsys_on_dfl(memory_cgrp_subsys) to decide which flag > > to read? > > Yeah, let's not preemptively add explicit new features to cgroup1. > > Since we agree the incidental support is weird, let's filter hugetlb > charging on cgroup_subsys_on_dfl(memory_cgrp_subsys) after all. Agreed. It would be a bad idea to have an implicit behavior change based on v2 mounting options. And I really do not think we want to add this feature to v1. I am not supper thrilled about enabling this for v2 to be completely honest but I do see a demand so I will not object to that. -- Michal Hocko SUSE Labs