Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3906130rwe; Tue, 30 Aug 2022 00:24:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR4WnkFmfxdFmddWylzzUnd50O4YcFUSiPdLbg3Pup5/RU+Ydgumi5vRga50IUWNjrnownDt X-Received: by 2002:a05:6402:20b:b0:440:cb9f:c469 with SMTP id t11-20020a056402020b00b00440cb9fc469mr19711709edv.420.1661844286459; Tue, 30 Aug 2022 00:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661844286; cv=none; d=google.com; s=arc-20160816; b=gVl6v4314SsNee4tWMGCWqApZAsGsvMSq/djOgqg3k0HKyPJtSqKchhDVnm8M9ORQI W+gmeLrQ5pW/qla5C+LCHr+Wim4A8uRnTFbYG+sAs3zUgvQxJvxUSOWg2hCyPU/wCYej TkN2hCUUu4e5XIZlVfmeejwSdqZLAixOiJqBDCHvPe4RYpnv8kO92SDgQvcY+ULIZoU9 iiCr6ZkPFHvalk0xduMGXeE2SmLZ5BnMrm4Zxkbb4WldIWgZZUzbZcnwzcP4/V50H7Cf Fg2YE6/7YJo/H/a34K6CC9KW5ha4tWXpx8D9JeynhLos3ucJODMLJ96N5X8RUOQwtwJd 2pTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eNLXbzHMzQQl1S+F8MG5tq68Rc2DBXxOVacQ+xIc0Yc=; b=LIuFjsWig8MzhJFdR7iaEzGzo+BgyOiyYWNDoEa3KNMPmKiNodar/sHjdTvUS1bqro SGIw8mvhldDy0m8chq2wO2vJJ0FHjnPBp744txKGKy3rXfEVeLqoO8kzh1t7GDs93B4b yhEnfAjTj4kAu1onIUfsxfZxvOAr8UI/VHHOa2oric56N8sp+SfluSEx8uxX4Upn/v67 AnYOhOBHlomOD5NTBlXjSmiA81cj4Z92SSuk4TpQqiV9exO1sgiVz4XarRC5I3lyL4Cw Wv5unUKYVaKObkJfE5UzV2Ejo2/B4586eybyZT+LpO/mfJRzthGzNvJs8oTUgaDu4sfd ANvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="Y/SIOnqS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e7-20020a056402190700b0043dff638b33si9168970edz.285.2022.08.30.00.24.21; Tue, 30 Aug 2022 00:24:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="Y/SIOnqS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230407AbiH3HMy (ORCPT + 99 others); Tue, 30 Aug 2022 03:12:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbiH3HMw (ORCPT ); Tue, 30 Aug 2022 03:12:52 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA5FEAE208; Tue, 30 Aug 2022 00:12:50 -0700 (PDT) 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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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