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 F4066ECAAA1 for ; Tue, 30 Aug 2022 07:12:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74164940007; Tue, 30 Aug 2022 03:12:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F1416B0074; Tue, 30 Aug 2022 03:12:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B89B940007; Tue, 30 Aug 2022 03:12:51 -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 49E8A6B0073 for ; Tue, 30 Aug 2022 03:12:51 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 19E66804E5 for ; Tue, 30 Aug 2022 07:12:51 +0000 (UTC) X-FDA: 79855391742.20.5576C07 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf31.hostedemail.com (Postfix) with ESMTP id A07DB20011 for ; Tue, 30 Aug 2022 07:12:50 +0000 (UTC) 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 8A9EA21D09; Tue, 30 Aug 2022 07:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1661843569; 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=eNLXbzHMzQQl1S+F8MG5tq68Rc2DBXxOVacQ+xIc0Yc=; b=Y/SIOnqS5qw04flbBT0UNoziQh4DL76iydFlVllZY+A0CuuiymDctwvPAVb0iymIopbpe6 KWyit2vQ1FPjzGG9nhgthU0208gtfTPsZ9XcW/V8t71kobfUGPIF+eiPIJinYYrhCvFyX5 qDDPWjg5H/fGrgXOVU/fO5Q+N/WngCo= 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 6B9D413ACF; Tue, 30 Aug 2022 07:12:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8VW6F3G4DWNXLwAAMHmgww (envelope-from ); Tue, 30 Aug 2022 07:12:49 +0000 Date: Tue, 30 Aug 2022 09:12:48 +0200 From: Michal Hocko To: Kairui Song Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] mm: memcontrol: remove mem_cgroup_kmem_disabled Message-ID: References: <20220830055949.12640-1-ryncsn@gmail.com> <20220830055949.12640-2-ryncsn@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661843570; 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=eNLXbzHMzQQl1S+F8MG5tq68Rc2DBXxOVacQ+xIc0Yc=; b=CI0dd9RkcfNf2M8MXClTX+ylpMBwt8SRWes2sSL+s5jkux34GoRRjjfY4+fh7y1CNSQtbr G2mkUJINjLqUmd6DT+rce8WQbfX80WQx2BwU5NtDFtCKr3R836/9QrJr29MW0ggILB85oW noleRYxh3VsGai1w9Jiy2mcgpIvlcn8= ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="Y/SIOnqS"; spf=pass (imf31.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661843570; a=rsa-sha256; cv=none; b=Pa/8rR/ZGC8spFQvwZ7Ildk0RVwB/NpL+rbTGBMnH7sZl1KGUvDVvEM+xmAr8ffqKHXb5L 1/1mepXgna55wSOl3fj/BwMPBNRY9N7q4bImrfaG1rQCi8mlFgTs/vGVBDy0Nkq6yr7csE UCA8qJSV9Bt8laFSbvxNkwfLFfam2/M= X-Rspam-User: X-Rspamd-Queue-Id: A07DB20011 X-Stat-Signature: 7hugmjzi4pfo3faj5tqojn74jjwxustw Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="Y/SIOnqS"; spf=pass (imf31.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam08 X-HE-Tag: 1661843570-491751 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 Tue 30-08-22 15:06:57, Kairui Song wrote: > Michal Hocko 于2022年8月30日周二 14:45写道: > > > > On Tue 30-08-22 13:59:48, Kairui Song wrote: > > > From: Kairui Song > > > > > > There are currently two helpers for checking if cgroup kmem > > > accounting is enabled: > > > > > > - mem_cgroup_kmem_disabled > > > - memcg_kmem_enabled > > > > Yes, this is a bit confusing indeed! > > > > > mem_cgroup_kmem_disabled is a simple helper that returns true if > > > cgroup.memory=nokmem is specified, otherwise returns false. > > > > > > memcg_kmem_enabled is a bit different, it returns true if > > > cgroup.memory=nokmem is not specified and there is at least one > > > non-root cgroup ever created. And once there is any non-root memcg > > > created, it won't go back to return false again. > > > > > > This may help improve performance for some corner use cases where > > > the user enables memory cgroup and kmem accounting globally but never > > > create any cgroup. > > > > > > Considering that corner case is rare, especially nowadays cgroup is > > > widely used as a standard way to organize services. > > > > Is it really that rare? Most configurations would use a default setup, so > > both MEMCG enabled and without nokmem on cmd line yet the memory > > controller is not enabled in their setups. > > Actually I don't have too much confidence saying that as well... but > AFAIK, almost all distros will create a few sub cgroup on boot by the > init (eg. openrc, finit, systemd). Yeah, but do they enable the memory controller as well? Unless I am missing something this will require at least one memcg enabled cgroup to be created. -- Michal Hocko SUSE Labs