Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9942307rwp; Thu, 20 Jul 2023 12:03:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlFhWoRvDJ9MIzo6M22C4mJWh6PDy8YhYME9taKqB31xavF74unHVLzjWQetx4MvVa+zF45x X-Received: by 2002:a05:6a20:1593:b0:118:e70:6f7d with SMTP id h19-20020a056a20159300b001180e706f7dmr349217pzj.10.1689879824758; Thu, 20 Jul 2023 12:03:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689879824; cv=none; d=google.com; s=arc-20160816; b=t7Z82YhuBmHCpD8dZPP2Rfb9+zJf8nvsvMeo0zEf+QBpJNtF4CQw2fFbPZ3J63xZQ6 LsBF9qEKklx+qaDbQOmIcMARntsDOgxHe1rcS0xKgmTX6ndn2NKq7VXgFYXz54cbRLOS tCJgIpLxq9CVdrhhiV4rwilpnXRSSsFzAahxHqxhjonYRbVrstD+alBNvp9cz9GYtroL wq0eNKWpt53WCOYi+eJZkzeyv5KgbL8sOBF2qE6p0l0/namvJ58dwWedLDakaW5H/eUs 8w7zAM8JqQn6x/5QIbcZwvho7GsYBt0SnzyA4AVIHHcl2SwRbiH+/rF6qLFbvrbvJI07 iLMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TVc0DH5y5ZMGm3BerZTpK/u+XD4hMTin0vDBzxNt6yk=; fh=wzmEFQ3+orwDPp7H5x18Xi5SmBC086DkjuGJ57aBclU=; b=00meWZNJ+7XRgSRXeUNArOhOntfdVE8xlYK6a3O8UU6O/pzGFQr4vtpmGlt/HJOt1y TQ8eJJV2voPGi3MpaxaWMEJ394ObCK+xlocGAgrkF8ydbI2QH5RemGNmLicL0TATEKHO +vRRzBWmoHemHtachVsGn2SRWdOUdJ0mQiDb9Bkui+Js45agKqHcHd6ecga4ADzIFXBs RzHuKIHrZ/9yfpUk1FLrCbgqWThIMSCu07XzaHp0ox3HAAzIuSSvP20mjvhew6yCCUxi XdbZ+x9VPpkUKtn2vUfAXzwwLAwPE5VEzi8/qwGSZJTWUp+1naqrFBqNtjXSWURCQDpy GxLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=k0wUa4Bc; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q21-20020a656a95000000b0055bc21d797esi1351574pgu.231.2023.07.20.12.03.30; Thu, 20 Jul 2023 12:03:44 -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=@infradead.org header.s=bombadil.20210309 header.b=k0wUa4Bc; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232056AbjGTSbB (ORCPT + 99 others); Thu, 20 Jul 2023 14:31:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbjGTSbA (ORCPT ); Thu, 20 Jul 2023 14:31:00 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3831E135; Thu, 20 Jul 2023 11:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description; bh=TVc0DH5y5ZMGm3BerZTpK/u+XD4hMTin0vDBzxNt6yk=; b=k0wUa4Bc0gX81i186z/h55eQuL vN2ed/onpM28iKxC4yEvpheHnOUG0NwZNNTD58Efa5NxWnv8JEi+GPkO0rBNzcOVbiOC0JDx4vExy 62BA0UYuhCnDDXCUAcHUFoby7XFd5M9jWSdS9lfREMafDc3OHhgbMYx7lejYTutJ2gFH9OAkhkD2q Iex0W2rl79yFoa2zJp4tUDJuQY6KkxOA+6Q/NVHpzYBA8oL3jzUcj/YbCkwN9ejIWCcVMrHZOMy/e oILegG1jfTpeFUg80y2sMHbIdrvmHw5WpoMbIiyPvoeDu0hQru9bMv/Xx+SN3p+prtgLGa3MNUuJw 4iYrGLKQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qMYQL-00Bu7e-1E; Thu, 20 Jul 2023 18:30:49 +0000 Date: Thu, 20 Jul 2023 11:30:49 -0700 From: Luis Chamberlain To: Yosry Ahmed Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , "Matthew Wilcox (Oracle)" , Tejun Heo , Zefan Li , Yu Zhao , Kees Cook , Iurii Zaikin , "T.J. Mercier" , Greg Thelen , linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org Subject: Re: [RFC PATCH 7/8] memcg: add sysctl and config option to control memory recharging Message-ID: References: <20230720070825.992023-1-yosryahmed@google.com> <20230720070825.992023-8-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Luis Chamberlain X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu, Jul 20, 2023 at 11:24:20AM -0700, Yosry Ahmed wrote: > On Thu, Jul 20, 2023 at 11:13 AM Luis Chamberlain wrote: > > > > On Thu, Jul 20, 2023 at 07:08:24AM +0000, Yosry Ahmed wrote: > > > Add a sysctl to enable/disable memory recharging for offline memcgs. Add > > > a config option to control whether or not it is enabled by default. > > > > > > Signed-off-by: Yosry Ahmed > > > --- > > > include/linux/memcontrol.h | 2 ++ > > > kernel/sysctl.c | 11 +++++++++++ > > > mm/Kconfig | 12 ++++++++++++ > > > mm/memcontrol.c | 9 ++++++++- > > > 4 files changed, 33 insertions(+), 1 deletion(-) > > > > > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > > > index 59b653d4a76e..ae9f09ee90cb 100644 > > > --- a/include/linux/memcontrol.h > > > +++ b/include/linux/memcontrol.h > > > @@ -60,6 +60,8 @@ struct mem_cgroup_reclaim_cookie { > > > > > > #ifdef CONFIG_MEMCG > > > > > > +extern int sysctl_recharge_offline_memcgs; > > > + > > > #define MEM_CGROUP_ID_SHIFT 16 > > > #define MEM_CGROUP_ID_MAX USHRT_MAX > > > > > > diff --git a/kernel/sysctl.c b/kernel/sysctl.c > > > index 354a2d294f52..1735d1d95652 100644 > > > --- a/kernel/sysctl.c > > > +++ b/kernel/sysctl.c > > > @@ -2249,6 +2249,17 @@ static struct ctl_table vm_table[] = { > > > .extra2 = (void *)&mmap_rnd_compat_bits_max, > > > }, > > > #endif > > > +#ifdef CONFIG_MEMCG > > > + { > > > + .procname = "recharge_offline_memcgs", > > > + .data = &sysctl_recharge_offline_memcgs, > > > + .maxlen = sizeof(sysctl_recharge_offline_memcgs), > > > + .mode = 0644, > > > + .proc_handler = proc_dointvec_minmax, > > > + .extra1 = SYSCTL_ZERO, > > > + .extra2 = SYSCTL_ONE, > > > + }, > > > +#endif /* CONFIG_MEMCG */ > > > { } > > > }; > > > > Please don't add any more sysctls to kernel/sysctl.c, git log that file > > for a series of cleanups which show how to use your own and why we have > > been doing that cleanup. > > Thanks for pointing this out, I definitely missed it. Will do that in > the next version. I guess this will also reduce the reviewer churn if > I won't be touching kernel/sysctl.c? Right, it means I don't have to care anymore about random sysctl knobs. Let people knob it all up. Luis