Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp871244rdb; Fri, 26 Jan 2024 13:28:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfKmKkwfCUDygK8n+PpLghsI+0L4JrlRRvr6ys/WBrc5BqFi23/WNmIPYVzneJDRnrtppQ X-Received: by 2002:a05:6402:3590:b0:55c:916a:7aa0 with SMTP id y16-20020a056402359000b0055c916a7aa0mr257819edc.6.1706304524602; Fri, 26 Jan 2024 13:28:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706304524; cv=pass; d=google.com; s=arc-20160816; b=VRtUqeEZWJMUI5jnp577Ki6EJ76sj2e3FUG8SHfKBgnQCUYF7JZHZPDx71yxZUs8Ob OY90wJO8PP40r8LVoX6Tk5umTEkXnQBxhAD3JfTc2uKEMRmdkCRfmh2iuI2CKD6idISy txUzppQzhqpmHajI4y4hA5hST+H3VPWqUuaEF78HyPg1XPeCuQJGmHkpn1Mf97OlR8tg SueaYVF9X2ZMzDUSbxP28mwIJFr7T0Ux9pd8WmQeQEX1VVZ14NkllQ5WbC60ibqXMS0M t7eCWl9cm1ALp8yfJQTYEC2q5cUe/P8Q/X1BCaT/YXBsXrNZsRfWELT/sx0eezorJpjN JBpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=gNqHsP0QzNPcNrc9Xlx0VNVIhnZmWNJT8PJvuvOCBDE=; fh=/3sWLLrKCwzT22jneZTUYCDKOTsTp8mVFg/XjL6ygfk=; b=iLq80KJ7yarrgKIfMpa+w6bsT07uicRc7KBXrE2X5hkH93hjTK2u5z56fpVo/AlSbA 9c0F9hy4CPShFUsFPYdD6GS45t7MZ47mDV4ZZwVBKE3QmDW4qhhMoOIJStOdK2NgECsM Wr60V/Z0AopNolmic8KAOl0oHgGj76XdXRPcHmu8Q1wljQKNy7g+bt6kAmugjoiw+SIv fI4Sy8AnQOS/XqWzCKo1WT4mzIL0bUO08rZUmAhx7+GyIhHXdOTyYCO3YlzKzr0fNBZ/ OIc8Pi7G6BqE40MONhza0slNfHhxnMLfD7kcTzWTHz6kFW4uHxv6pM67ijHsCRpeo/Wc LLWw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MXv0mHLg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-40672-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40672-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ek22-20020a056402371600b0055ce4ea1daasi1121436edb.110.2024.01.26.13.28.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 13:28:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40672-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MXv0mHLg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-40672-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40672-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5EC441F22CC9 for ; Fri, 26 Jan 2024 21:28:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD33C24A0D; Fri, 26 Jan 2024 21:28:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MXv0mHLg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04BE9249F7 for ; Fri, 26 Jan 2024 21:28:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706304516; cv=none; b=Kl7Q0aRUyZ/1BEdTXnMjs4htE5RvQWSshqcpUSrgIb3xQu3YJHOA28PSQlhALSsXWRssp/vqIBqTy7Dv56QLDOH4MKBfsc6vvVRRC9SKNabkiH38bQbdSPKVAHFepWZaY+ADyFEN4nvTPM/xi+L9m4SIDprlIFDhfiy/Ng1xe48= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706304516; c=relaxed/simple; bh=YPfJESNx63f8gXc8lRLZ4SNiww8xBncvURRDWEv5tbo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=UpnHsytD0sWvtg8VhOv0WJZnlicxjkt2UPIuUKcU0CdF1XB9k1F0YkXLEKThiZjznbzhJrP1dc0Hva3IjD1DSplYBxz+02r7LCM/xAornhU5r5zNTGh72AIzkratHPMAfA8n43jyivt5aty+WibFW9kca+fbkX0JUCsdI6Zt6jo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MXv0mHLg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FA68C43330 for ; Fri, 26 Jan 2024 21:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706304515; bh=YPfJESNx63f8gXc8lRLZ4SNiww8xBncvURRDWEv5tbo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=MXv0mHLgFzPXzyJ+cXnF0NEHqEVMZis5J3xCyKd/vUQ+sNHMTeOvo5/UiRtp2prgn 3W/Ekzx29ky6ERqEG0FCD5c6Ax2AAJbBymQJM+C2XVk0rB5/CW42DI8ekyEPrBRgTJ Yqww8uOrdI/9wrwSyWcdaYFXqfOdoVOyWi5kA7B2gIpzbcjEiukdn/CrhmcXkxn0Bw 5xB52zJNgfDqQyfu23v4p6ZkQ9QhiLlxF5utjPu5p4kRaffbFWCjmyECdEyz0Iosfj ECliNn6S60owiB5Y3Dt7zuQUzi8wKpJ+RVoa08wc4iNDVH2z0tQOTXHHNP4ZS4f+TQ QNW4TQCmxSN7w== Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-7bc32b04d16so37183639f.0 for ; Fri, 26 Jan 2024 13:28:35 -0800 (PST) X-Gm-Message-State: AOJu0YwNCz3CE1pEH/r2DKmj9xJ1wBjwJMpfs6SR6rafAA/tvlYi65lp TGTXpMpBfz1pIzcAngLKrelfKfgco9MQBAMEYCmZTQCaFwmG0OWxOzwMnRUYTy0gO0HvSie3BBE IwUhe7BboyJnVgW9+itEOFIlMjrU960k+kWS/ X-Received: by 2002:a92:d388:0:b0:361:98e2:90b1 with SMTP id o8-20020a92d388000000b0036198e290b1mr437960ilo.20.1706304514841; Fri, 26 Jan 2024 13:28:34 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240126211927.1171338-1-tjmercier@google.com> In-Reply-To: <20240126211927.1171338-1-tjmercier@google.com> From: Chris Li Date: Fri, 26 Jan 2024 13:28:23 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] mm: memcg: Don't periodically flush stats when memcg is disabled To: "T.J. Mercier" Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , android-mm@google.com, Minchan Kim , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi T.J. Acked-by: Chris Li Chris On Fri, Jan 26, 2024 at 1:19=E2=80=AFPM T.J. Mercier = wrote: > > The root memcg is onlined even when memcg is disabled. When it's onlined > a 2 second periodic stat flush is started, but no stat flushing is > required when memcg is disabled because there can be no child memcgs. > Most calls to flush memcg stats are avoided when memcg is disabled as a > result of the mem_cgroup_disabled check added in 7d7ef0a4686a > ("mm: memcg: restore subtree stats flushing"), but the periodic flushing > started in mem_cgroup_css_online is not. Skip it. > > Fixes: aa48e47e3906 ("memcg: infrastructure to flush memcg stats") > Reported-by: Minchan Kim > Signed-off-by: T.J. Mercier > Acked-by: Shakeel Butt > Acked-by: Johannes Weiner > --- > mm/memcontrol.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index e4c8735e7c85..bad8f9dfc9ab 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -5586,7 +5586,7 @@ static int mem_cgroup_css_online(struct cgroup_subs= ys_state *css) > if (alloc_shrinker_info(memcg)) > goto offline_kmem; > > - if (unlikely(mem_cgroup_is_root(memcg))) > + if (unlikely(mem_cgroup_is_root(memcg)) && !mem_cgroup_disabled()= ) > queue_delayed_work(system_unbound_wq, &stats_flush_dwork, > FLUSH_TIME); > lru_gen_online_memcg(memcg); > -- > 2.43.0.429.g432eaa2c6b-goog > >