Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3926415rwe; Tue, 30 Aug 2022 00:58:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Zfum1Y/aBqVXhouZRslX1rPN62m69LMCqfodLoGQa6uryBBZpJb7qSgV5d5wBmin2kx7x X-Received: by 2002:a17:907:6297:b0:72f:9aad:fcb with SMTP id nd23-20020a170907629700b0072f9aad0fcbmr15871305ejc.161.1661846317114; Tue, 30 Aug 2022 00:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661846317; cv=none; d=google.com; s=arc-20160816; b=lbcZ7l9X6/iL0ennhUzeSZ1v2wDPnSSSrSaJyl2TIn/6PcQT0xot2vdY6Eov+yVA3G MCtSrgUlmDcrVv1oxliVDTX1/PXWJt+Em32yYlzLXc2qidxNpcv7xPFpS2cXXpoeRVvM Yc1aY0OppmkSRkQN18K9Et3vVAgugTpVu3Ejbh69Ljmo3PRCJydwpWxDN/0nY91xBW2N q259BvVcgPlGKSQN/8piKuXxBhmcw/jWYr4rnku5ETqqFHcIFRqb5kPtICnDmP5c538a DzlIfrNTuIn0Ga2DYD+d5m822e0CnWAeASCU8QyEBQStiILfU31/KZaxU2NyllFvvhLd T7hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=96IRGBfcr5J9/GRtulzalfsCYmkGXye7ZPp+1XPMemc=; b=H+5sIIQT7Xg29LjbQWlgdDRpLyzKUnaiaGAX815wNC5LntrMxzQ0XjTYa+aLmK75fO JgULe8wNPLyNp0dxB/qURtZm2ShOtKGU8tWr1o0IgUto/QMto6hGAqLhptMVvDIbYxMn 5zgAkhLhW0C611NF4vy6hQ+nzH30iAZAcfO0MseyltojxiSa5tetPFOpvzkH/Y0XZf97 3Zyv8o1xWTu0cPbEvdgpPw7Pm2ZrlTx7il+rmOtyIGX7FNyeBYRMEkma+lpdF+J2BDGr WL4zaGe8vgnm5HzQXLLjsDK9fRt1X8dyA6jdHRazM9RMlAjJNB73+Ce49UF+UstSpIaP WnnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZaLX9vwl; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a056402510900b0043bc778b19asi8890212edd.166.2022.08.30.00.58.11; Tue, 30 Aug 2022 00:58:37 -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=@gmail.com header.s=20210112 header.b=ZaLX9vwl; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230499AbiH3HpS (ORCPT + 99 others); Tue, 30 Aug 2022 03:45:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230375AbiH3HpQ (ORCPT ); Tue, 30 Aug 2022 03:45:16 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4292D13D6D; Tue, 30 Aug 2022 00:45:15 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id f24so7568623plr.1; Tue, 30 Aug 2022 00:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc; bh=96IRGBfcr5J9/GRtulzalfsCYmkGXye7ZPp+1XPMemc=; b=ZaLX9vwlsNnUkPUmS7uMrUQJ7sNnSHEUaPBpt/On8HRnJbnSVy/lt90ZvWaMRgor2i Ph/rqPOrHM7aPfcaIlY/XJfjku5scFdKAyvPfDJa9ks7ySKCKEO0BxxGEFjnF39umarH AMMDGE9E6m0WhJbo6qgTLl1DORwnZX2YcomKG8ffyLrZT/NEXUpoVxGH5gUhiyEZGnqO PgRJvnA6bxgbbt2Rwl8MTOpxXAjj8XWtjK+XDpKSlB2qMxtkiIgo/MCR82RisAtQBsxF s+vPiZvoPHE8IFRDP2KxneJsozXta4d922Ya/hudxh32NBklMno0ZG7SB1NjCvkqQjAk 2w/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc; bh=96IRGBfcr5J9/GRtulzalfsCYmkGXye7ZPp+1XPMemc=; b=p7xE4Z9UP8e85Z5S8mGugeXdXmliOKzs2J1mGaCCwz4ftmoxOEmdlQb+ow5uGJnoYK bbwurXDFK82bajfdtTcew6YIbQw6Zp5sKjJt3fI+pxj75u8ofqLaxCpGKBM0fb40twTm R9eeNQuqd60lPgnPiTtcRcYw6cWQ0KadK8qLQ68YkQ40bTC61k4YxOroSzj9z7og3Q7q Ec6E7dIg0TKI+xDbVhCn/aWxzyWCZcUPztn5cES6H72UmFcVpRUQfZFQpOMtWRnCB76h D+dw+dGNX3jgxaO0cZlgS15uN4AikCs6Yn8b+TDFX4/2jNpKzfUU8cUiRlqOZohI/bQ1 G1gw== X-Gm-Message-State: ACgBeo1fibtVSDGU5ZocMc+kc1SXRMXz7kxtpdH/LDeyLvfwqXq5SFoJ O2XFD9w9Q1S5EmTvggVRhv314VZ1C6rjbfaLWTY= X-Received: by 2002:a17:902:a982:b0:170:d646:5851 with SMTP id bh2-20020a170902a98200b00170d6465851mr20500615plb.134.1661845514795; Tue, 30 Aug 2022 00:45:14 -0700 (PDT) MIME-Version: 1.0 References: <20220830055949.12640-1-ryncsn@gmail.com> <20220830055949.12640-2-ryncsn@gmail.com> In-Reply-To: From: Kairui Song Date: Tue, 30 Aug 2022 15:45:01 +0800 Message-ID: Subject: Re: [PATCH 1/2] mm: memcontrol: remove mem_cgroup_kmem_disabled To: Michal Hocko Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Michal Hocko =E4=BA=8E2022=E5=B9=B48=E6=9C=8830=E6=97=A5= =E5=91=A8=E4=BA=8C 15:12=E5=86=99=E9=81=93=EF=BC=9A > > On Tue 30-08-22 15:06:57, Kairui Song wrote: > > Michal Hocko =E4=BA=8E2022=E5=B9=B48=E6=9C=8830=E6=97= =A5=E5=91=A8=E4=BA=8C 14:45=E5=86=99=E9=81=93=EF=BC=9A > > > > > > 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=3Dnokmem is specified, otherwise returns false. > > > > > > > > memcg_kmem_enabled is a bit different, it returns true if > > > > cgroup.memory=3Dnokmem 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 nev= er > > > > 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. Systemd enable memory controller by default since ver 238 from 2018, but I'm not sure about the others. Now I think I was wrong about the assumption, will be sure to do more homework next time. And thanks for the review!