Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp273198rdg; Tue, 10 Oct 2023 09:49:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEALNTaOKpbqwz0Pv5Gap4KNdNM2NdUuyVDpKXhESo2SWu1FYyeKjQpDUWcxwAr7ARK7uu3 X-Received: by 2002:a17:902:ea0b:b0:1c7:22dd:dc43 with SMTP id s11-20020a170902ea0b00b001c722dddc43mr20630327plg.15.1696956553735; Tue, 10 Oct 2023 09:49:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696956553; cv=none; d=google.com; s=arc-20160816; b=b6dGmxMTu2SdUudMieLYRbRnQXf2vZ2bjaats9+EwmQlwm6orBBuRCdf0jMi4Cc2PW 4mld+U86QiDhQhLud+LElDKxy/d8yGYikrqVdWt9Gslid86H1FGxrzC6RC64votHScMR /cI4rcsUXv1EuKqnhXhtWrjbv/hCwYp50Kj06ubQD0h2BWMmAjtPDkrOF8hrHjC2KTqg E2lnK4Ox6SqPOl8MU8czjn3wmFEonAfsDPk+vBzxdD6xHC7xUcOrJb4ecKMttlpiyRd3 v4/x5SjPV+kG5pilTjTb/wRBw2efQtNVnh2Z7jy6wjjk8b7vcOuYtM9HIScds12QsBL2 LNBw== 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=F6yfbZUcdTYweQuQIVJ4G7iiHQ0Y4iE8YHYGN5BB78g=; fh=dNsT3iEN0ixZp/eZpws0zwN5n1FmomAxwivztVRqzLs=; b=ZkYQn0p+UG2D8YejyzOB7R3tYHrVxiTVZFQi1osUOPCiTJH6C5/mGnIvjZrU2H0w/E KhGvh1NVwGSD2XXDIUVPIIeXyQivutF084ebdiPI0L+Z+H0k2vKhK7Z8dk9sXbzxl1bt Og1M7w9m0o8jC3r74Nvdx2R1V2spxQWzCJqPi1ZzyQjKRmIqrv4+fQ/s2sACnPj/tVVk nwSNuVdbf4Px7hBKCD9mJqOoi0KhZ+Ecw2Ddjy3YuvuwRZYzCNcBqURkVOylLTeL7exC zXGICaM0w7uL3Qtiju3eTZSv/Ev/FKKjqVFQ0g9jUoE3qUZ+9uqB5iSPGWwwM1UvkVJZ 2zXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=M667UaDe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id j7-20020a170902da8700b001c60c109ce7si1742741plx.295.2023.10.10.09.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 09:49:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=M667UaDe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id D98C28374CB6; Tue, 10 Oct 2023 09:49:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233867AbjJJQtA (ORCPT + 99 others); Tue, 10 Oct 2023 12:49:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232338AbjJJQs7 (ORCPT ); Tue, 10 Oct 2023 12:48:59 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 301958E; Tue, 10 Oct 2023 09:48:57 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id 3f1490d57ef6-d9a5adc8cefso1008413276.0; Tue, 10 Oct 2023 09:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696956536; x=1697561336; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=F6yfbZUcdTYweQuQIVJ4G7iiHQ0Y4iE8YHYGN5BB78g=; b=M667UaDewUiIRCot52Asmdw75GRjVUueZRmmT+qwUSIhXUat/GGao6ACXpToELgwFB DeXarmYeXk2Wo4oIbmyxslW4wr4cXbAj/lCuMjMPLwW04G/XXB4xqM2a9tQwOK3O904+ n3bxFuv+c5K4IY6YW3688u9ZoRP3HGo0lj9LnnkB2kv4EMAdhTz4sxSHXHSZDQKiBgZF b5NbTO1YzNVLaT5El+7/k8cpeHkouDrkgKddNow7uj/W68o9YERZT2SNyxwN+sL+Ib32 JGMKLE62XbH5bEuKQLGYTD9vpl4CAdWVv9BAGikHEuH9C/8e5ALaSWXj5XB6CHcAsELY VpJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696956536; x=1697561336; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=F6yfbZUcdTYweQuQIVJ4G7iiHQ0Y4iE8YHYGN5BB78g=; b=Bnr35v6J84Y+AxNIX98uGmFqfuin/xhLjkoF3lOS0xDKYeU1qNY+PNjFMSNJ4KZNC+ esi349OPs1ab3Ip+ZIdbL+zHB7o0IesIR5JLvc45a2gxVjLlr72d7K3mL9Td9+QinUDA aDREldrxHHhteyJoyAaWtsIA5k2kH4i0jhe96SZO+6LbA7lMwOUFRA+4FJpc0MHspMzt 2GASb6vyZ6Haf1l8bjc9jRHPByy2Hc6daVNYvXV93Xn4z98EUUSbWsC88xep6v/I8nhT O87ISz8jgbCp8SOchrqBZb7L6prqNHhVS1bU2tEOchdo5SIAjeeE+E4OHWuK2MAt4d40 kqSQ== X-Gm-Message-State: AOJu0Yy+lfoET7mM6SV5hTL8k5Z84tOZtwvQA0IuBL+bp+Kb05MRZM40 hEBLMlgdVhqb3hbG/jK+SuTKfAD3VmYGAvKODKg= X-Received: by 2002:a25:2390:0:b0:d9a:4367:1a92 with SMTP id j138-20020a252390000000b00d9a43671a92mr3092795ybj.50.1696956536082; Tue, 10 Oct 2023 09:48:56 -0700 (PDT) MIME-Version: 1.0 References: <20231010032117.1577496-1-yosryahmed@google.com> In-Reply-To: <20231010032117.1577496-1-yosryahmed@google.com> From: domenico cerasuolo Date: Tue, 10 Oct 2023 18:48:45 +0200 Message-ID: Subject: Re: [PATCH v2 0/5] mm: memcg: subtree stats flushing and thresholds To: Yosry Ahmed Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Ivan Babrou , Tejun Heo , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Waiman Long , kernel-team@cloudflare.com, Wei Xu , Greg Thelen , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 10 Oct 2023 09:49:11 -0700 (PDT) X-Spam-Level: ** Il giorno mar 10 ott 2023 alle ore 05:21 Yosry Ahmed ha scritto: > > This series attempts to address shortages in today's approach for memcg > stats flushing, namely occasionally stale or expensive stat reads. The > series does so by changing the threshold that we use to decide whether > to trigger a flush to be per memcg instead of global (patch 3), and then > changing flushing to be per memcg (i.e. subtree flushes) instead of > global (patch 5). > > Patch 3 & 5 are the core of the series, and they include more details > and testing results. The rest are either cleanups or prep work. > > This series replaces the "memcg: more sophisticated stats flushing" > series [1], which also replaces another series, in a long list of > attempts to improve memcg stats flushing. It is not a new version of > the same patchset as it is a completely different approach. This is > based on collected feedback from discussions on lkml in all previous > attempts. Hopefully, this is the final attempt. > > [1]https://lore.kernel.org/lkml/20230913073846.1528938-1-yosryahmed@google.com/ > > v1 -> v2: > - Fixed compilation error reported by the kernel robot in patch 4, also > added a missing rcu_read_unlock(). > - More testing results in the commit message of patch 3. > > Yosry Ahmed (5): > mm: memcg: change flush_next_time to flush_last_time > mm: memcg: move vmstats structs definition above flushing code > mm: memcg: make stats flushing threshold per-memcg > mm: workingset: move the stats flush into workingset_test_recent() > mm: memcg: restore subtree stats flushing > > include/linux/memcontrol.h | 8 +- > mm/memcontrol.c | 269 +++++++++++++++++++++---------------- > mm/vmscan.c | 2 +- > mm/workingset.c | 42 ++++-- > 4 files changed, 185 insertions(+), 136 deletions(-) > > -- > 2.42.0.609.gbb76f46606-goog > > Hi Yosry, thanks for this series! We backported it on a 5.19-based kernel and ran it on a machine for almost a week now. The goal was to fix a CPU utilization regression caused by memory stats readings, it seems that this series was the last bit needed to completely fix it and bring CPU utilization to 5.12 levels. FWIW, Tested-by: Domenico Cerasuolo