Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1415400pxf; Fri, 19 Mar 2021 06:52:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4AR969XEZoSwl8LvV3nC2ABZXoEXvhNADhVo8XMR5lcYWJt3/k/0qvrDLxjcj7fTdZQIh X-Received: by 2002:a50:ec0e:: with SMTP id g14mr9695491edr.264.1616161934526; Fri, 19 Mar 2021 06:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616161934; cv=none; d=google.com; s=arc-20160816; b=kYtbr4rsdDZd2r3hlCeDhHazWF0sBiILDFc2MyTUS2PtwFjB/BqZc7Q3BP7t8r3Hq8 ZdFI7S9XfJFjDm3hOyFbde0gTlbb7q89RORN4cE9p3QZ4AG/PmLS4H+nv6QBL2XKaydA 2AgEyHMK+bTrOYn60NrLh1ZTBbuL3E4SDJtvySDGz0BzNTwBf/AnzvMdpEhSWaX0CjWH RFYKoqO/G31apU2SVX1NUL/W23KqqrLjEjSVUqMyjXv45S1LhA9C6F2ALb+VJGVTx+2L XSv6SLOXiX+n3J+dWb5PIBSSSWxSmt4aY56EFXmY4UXQLYo8708SCZkd0eSLl7RsYPKn jBHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=UsGaLcv8p/W1uMdTq13khVuGSy6Z0QJqkLpFYQ1bIJk=; b=IMJyIlrtowsW8oLjTpXrXHDxmgpbbUFOf1ScLUYCd6B7N7mEP8nEpalK1LVkPJ9pvI qoNbcB4NJuJFqgZXrkUjETMSxOrmExLN/kBgLMjphPTDV7xysRfMz7zMiVVJhJxXpCDq 0Px9Vh8aK+GlFPNXbQbSympwMnqNbouty0nXcyabIZ+EWc/xT+uo2lSVL1qm028uSdjY 8d06PDyQ+5SVA8p+bHfWTcNPB5rvHxgrQrBvgrAgX1we4ylm7Garnmv10XpzmfyXADJv DNWgcLZU3Vb/MThtyoV8/1ELuRcASTCRf5FoVgw/sVEp3JzDv03y78CEssqw+YOFOZJQ JpZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=i77Av+sB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si4317114edd.9.2021.03.19.06.51.51; Fri, 19 Mar 2021 06:52:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=i77Av+sB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229806AbhCSNui (ORCPT + 99 others); Fri, 19 Mar 2021 09:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229941AbhCSNuJ (ORCPT ); Fri, 19 Mar 2021 09:50:09 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18DD0C06175F for ; Fri, 19 Mar 2021 06:50:09 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id q13so10099886lfu.8 for ; Fri, 19 Mar 2021 06:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UsGaLcv8p/W1uMdTq13khVuGSy6Z0QJqkLpFYQ1bIJk=; b=i77Av+sBL8n+9UII8kK0PPrV0npH/0edODNbc1YUASq98qZ1gcvqBFDVwq1QLt1zyX 7s4RpGH1yxfP87oZyrB+44qDBZUm8EUWzYn2cMXYhz8eq1T6/ozPZSt3dMDmsjB1YKZg 6P2buZ8iGuy07bMMD+S2xdHzzYCWej0gyZK8KtUyVjNtJAzk6v/Lzp0MRhuESwTipzmm pZdGUo7CLI9ROlYI7rxw21LEGWx4f9FN7yZda+kKZtQ6rpPxkuV+78/gHaHWZ6a0R8i7 nGs9ZB98n7tT8UtgieFAhSqszHDkwHh7qHtzNJ0T4Nia0yB3JEVoR2Mv6s81hF0QcQ8l lFOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UsGaLcv8p/W1uMdTq13khVuGSy6Z0QJqkLpFYQ1bIJk=; b=hKwsWKKN6u+05rSQS2N9tSvuXY1yLJoWPWuH4JRba8K1phro25l3KDbEuKF2eCMhWx kxIUIUMjk/jVhni9JhjDQmIOWUHPwFbcaH7AKbABDlto+bOSSohj3OcUEWel1GZ2pVw5 awaTHbyjRaG+UE+U86MpAi3Jrd8JH4FlDg/QK5DgCe3VV8WZSU/sTgazqR0xlztHkoh4 h4wt+Am88WeHAQ6fWdavqFiL6uomFmEp9fzXdO3WKGih96B+Hr8C7JnoPxAJ6kHLGFYa LIDvdZAyC4KmDJzjiGOt2cjXAVkEIEF3HnXor2QmQMa5BfQ+3TcudWiXUYDPjon9Vwk4 LrJw== X-Gm-Message-State: AOAM533CntTNVr53FOQRuFeU5iG3k6DO1b7zrgpFlKdKV6TU0GmdUBvh CVRT5WJsn9gy1kyi/TpJqU+DMCUdQRBghRXyv4tcpA== X-Received: by 2002:a05:6512:2356:: with SMTP id p22mr853666lfu.347.1616161807266; Fri, 19 Mar 2021 06:50:07 -0700 (PDT) MIME-Version: 1.0 References: <20210319054944.50048-1-hannes@cmpxchg.org> <20210319054944.50048-2-hannes@cmpxchg.org> In-Reply-To: <20210319054944.50048-2-hannes@cmpxchg.org> From: Shakeel Butt Date: Fri, 19 Mar 2021 06:49:55 -0700 Message-ID: Subject: Re: [PATCH 2/2] mm: memcontrol: deprecate swapaccounting=0 mode To: Johannes Weiner Cc: Andrew Morton , Hugh Dickins , Michal Hocko , Linux MM , Cgroups , LKML , Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 18, 2021 at 10:49 PM Johannes Weiner wrote: > > The swapaccounting= commandline option already does very little > today. To close a trivial containment failure case, the swap ownership > tracking part of the swap controller has recently become mandatory > (see commit 2d1c498072de ("mm: memcontrol: make swap tracking an > integral part of memory control") for details), which makes up the > majority of the work during swapout, swapin, and the swap slot map. > > The only thing left under this flag is the page_counter operations and > the visibility of the swap control files in the first place, which are > rather meager savings. There also aren't many scenarios, if any, where > controlling the memory of a cgroup while allowing it unlimited access > to a global swap space is a workable resource isolation stragegy. *strategy > > On the other hand, there have been several bugs and confusion around > the many possible swap controller states (cgroup1 vs cgroup2 behavior, > memory accounting without swap accounting, memcg runtime disabled). > > This puts the maintenance overhead of retaining the toggle above its > practical benefits. Deprecate it. > > Suggested-by: Shakeel Butt > Signed-off-by: Johannes Weiner [...] > > static int __init setup_swap_account(char *s) > { > - if (!strcmp(s, "1")) > - cgroup_memory_noswap = false; > - else if (!strcmp(s, "0")) > - cgroup_memory_noswap = true; > - return 1; > + pr_warn_once("The swapaccount= commandline option is deprecated. " > + "Please report your usecase to linux-mm@kvack.org if you " > + "depend on this functionality.\n"); > + return 0; What's the difference between returning 0 or 1 here? > } > __setup("swapaccount=", setup_swap_account); > > @@ -7291,27 +7287,13 @@ static struct cftype memsw_files[] = { > { }, /* terminate */ > }; > > -/* > - * If mem_cgroup_swap_init() is implemented as a subsys_initcall() > - * instead of a core_initcall(), this could mean cgroup_memory_noswap still > - * remains set to false even when memcg is disabled via "cgroup_disable=memory" > - * boot parameter. This may result in premature OOPS inside > - * mem_cgroup_get_nr_swap_pages() function in corner cases. > - */ > static int __init mem_cgroup_swap_init(void) > { > - /* No memory control -> no swap control */ > - if (mem_cgroup_disabled()) > - cgroup_memory_noswap = true; > - > - if (cgroup_memory_noswap) > - return 0; > - Do we need a mem_cgroup_disabled() check here? > WARN_ON(cgroup_add_dfl_cftypes(&memory_cgrp_subsys, swap_files)); > WARN_ON(cgroup_add_legacy_cftypes(&memory_cgrp_subsys, memsw_files)); > > return 0; > } > -core_initcall(mem_cgroup_swap_init); > +subsys_initcall(mem_cgroup_swap_init); > > #endif /* CONFIG_MEMCG_SWAP */ > -- > 2.30.1 >