Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1424305pxf; Fri, 19 Mar 2021 07:02:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWIszr+WkVewAjk5dK3oSUqxjrv2iOiETlWJd0gT75nGGrPl2a2Dg5zpMUEzBupgGBtaeu X-Received: by 2002:a05:6402:1157:: with SMTP id g23mr9722575edw.303.1616162544072; Fri, 19 Mar 2021 07:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616162544; cv=none; d=google.com; s=arc-20160816; b=NBOr/siRBQ3cVFpMmi6HUWhTYCOcCRlhsxLfqCmM+/pmT6mOn+/wthITO1Z1087EKs +ORxOA8J3d1slpvlwNLP2zP4b8RC/KaWG2pUWWas0e44uvIm++iOqC7f5uXkZGsWVk3o EmLKeSTOEXWKI8ykeHnlN1anOuo48D3ghQ3A8aBbUD78nNdUEsy/2aGJoeNszbEhtzC2 xXDYOw6p3BGD+60A71webqXXoIXie4P/yPoh2BZKh4UESbw57wG4QTP3fsPY8AUrA4Ee DBvY7z4FMFRDMc7WPfvVguz3PYs/xhtIngKNVJ9YxHwVKYX9+EC+dwQLKpOP1pf28IVR S5XA== 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=CCZAHZFhptxcyqdqzzX/b+llWDB9Z2cdnFChdhi5Vwg=; b=sE7XiABT8Sh9QQUIkj8uqjA/mj20rxWjy+heuDpqbGSlG5IMoCuN/nxez5KqJCM4Kn CKHgdIhyYQglyi//zpS3U1D5003CAMzJ83VtGtM/NUa1Gh35fpXMIC0Riv+Hc4nxaY3q 2v/+XXOc7Y7d53chM82akx6vscxRYAt+v125GCERNRMqeXF10P0W4I4wA+TranvIb1QK HO/OFcDyfldFadq9Awc/LAc+JL4kfbVgzP2q/PK00cCCQ4INZNL+zmrj3ylnz4R+56Da d5WUiaWd7dBiQO6+DJnLaGLP2vBwxibuJoa0lA4ywnNBA4lD56Pt7lRsw9njxpihxGwJ sR4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hbuafUMu; 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 o21si4195337ejc.724.2021.03.19.07.02.00; Fri, 19 Mar 2021 07:02:24 -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=hbuafUMu; 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 S229866AbhCSOAx (ORCPT + 99 others); Fri, 19 Mar 2021 10:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230042AbhCSOAm (ORCPT ); Fri, 19 Mar 2021 10:00:42 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00C80C06174A for ; Fri, 19 Mar 2021 07:00:38 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id u4so12105152ljo.6 for ; Fri, 19 Mar 2021 07:00:37 -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=CCZAHZFhptxcyqdqzzX/b+llWDB9Z2cdnFChdhi5Vwg=; b=hbuafUMuXP312PXrZHnMp/92FBrmirq42lyx06C8Agvn87xHEoPo7OQu6gl2wSVWMO I6doAnkI5UZ0G0OdBgSgw7TdfurM6EjLVZBa0M+Y5aZUPhfzckmx9H30C15CVZeAxFZe 4uxJHzgd5zNB2Shl7VKLfHcAFXrQwXeJ22Nl9RzXfrTV9PaT8nCUomECivrsQ5FaaqiI T/ltkh0E+Md2wAJzG94MHdJ1IKPJKBvqP5Tsd9Cnyp/TB1utqQwprQzjEXCNltXpJ/xP zC8uwR6rKEg5aBhOXxJ5CgMIva1CslYrhntNPzlA5wX9c0C5QrxEKEd066vPiNwcTJER pPfg== 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=CCZAHZFhptxcyqdqzzX/b+llWDB9Z2cdnFChdhi5Vwg=; b=O/gYnouEdTG6enjv6ThxkWYEjAxaZe0GVjRregzvVXBB40ll1CpsHomqJDKcsF7B4C gJsEvMTr1hp1yUGOsuKMvLxO+qusZqW7P7yp5pGi6bxc+TmtdEFAwrGW+NxTwiUCaHaw vBhTicV0O6h2lrjfTTvCuSpuV5wkG3pdJch7BTT6XQ0/XANF3RhvVxnGmjTivxr2wnu+ 65WycW3Rahv0hu7o1RBYQPth/Xq0m32LI76JTk98PqscKGvFM3PjazfIo/rJzV/opiyW 4+l0jEFUm5/j2/ZzsdOGLD3Ih6gy4V/k+H/xHn2r0x8gn0aEQW93Kz8NYVsMa7NyedRu ipVA== X-Gm-Message-State: AOAM5311SN0JWdVq5JpMDh6CUgcT9zqPeTeTwJKlIDAkpl7Qb3edAnxD JrTNYCwoH2qp342FhtRvTrzvKm1C2qqxMX0mNc6Sfg== X-Received: by 2002:a05:651c:2c6:: with SMTP id f6mr1035148ljo.279.1616162436265; Fri, 19 Mar 2021 07:00:36 -0700 (PDT) MIME-Version: 1.0 References: <20210319054944.50048-1-hannes@cmpxchg.org> In-Reply-To: <20210319054944.50048-1-hannes@cmpxchg.org> From: Shakeel Butt Date: Fri, 19 Mar 2021 07:00:24 -0700 Message-ID: Subject: Re: [PATCH 1/2] mm: memcontrol: don't allocate cgroup swap arrays when memcg is disabled 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: > > Since commit 2d1c498072de ("mm: memcontrol: make swap tracking an > integral part of memory control"), the cgroup swap arrays are used to > track memory ownership at the time of swap readahead and swapoff, even > if swap space *accounting* has been turned off by the user via > swapaccount=0 (which sets cgroup_memory_noswap). > > However, the patch was overzealous: by simply dropping the > cgroup_memory_noswap conditionals in the swapon, swapoff and uncharge > path, it caused the cgroup arrays being allocated even when the memory > controller as a whole is disabled. This is a waste of that memory. > > Restore mem_cgroup_disabled() checks, implied previously by > cgroup_memory_noswap, in the swapon, swapoff, and swap_entry_free > callbacks. > > Fixes: 2d1c498072de ("mm: memcontrol: make swap tracking an integral part of memory control") > Reported-by: Hugh Dickins > Signed-off-by: Johannes Weiner Reviewed-by: Shakeel Butt