Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2410852rdb; Thu, 21 Sep 2023 19:15:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEP2a3Qu2cSTErChbC8ihGpmLeokcoQMDdboXgCuUhoQ9Ek/eMcDPCFtUV8TtDf1Uohouh7 X-Received: by 2002:a05:6a20:a10c:b0:13d:d5bd:758f with SMTP id q12-20020a056a20a10c00b0013dd5bd758fmr7432426pzk.6.1695348938388; Thu, 21 Sep 2023 19:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695348938; cv=none; d=google.com; s=arc-20160816; b=CyY+pIlLfjJWHAVy+dVPYo93okkBYNHceNYTeanSiLFXM092J34BAptJDQI6VBn5no 1d7kFeYzvchG/N/MEqwsC/TbGJdPr46VUMHkxPj0bzt4jV6RYyA8sCAd4/zxLRJ5TlwQ de+0kyF3/8VXU9tksE9xyN+AgcmGrBMGnwvoabtppo44LBe8WU5YOWug6aX68yqcgpOY 61Un0hhP8FI8VrBsq+p+w/zh68dh6S4zDgqi3RevKD2y6iJL9o3XcpWLA09/1Ij6zOeU NI2SW546DSRE1JbnCMvPEtxA3Vk7172WGnMCRl51UW0Oh8feQuynd/1bqYzPvwnoU1s0 UIdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=mOW1s/LOhiEKmGFQGGQ/gb7iNiCsFWbcKv8d4ZT/dpI=; fh=i6r7D8Tbv5L0V2RUiJXfGU+sNI1eFV0UjCNL0oNyQ80=; b=UbHy6YAUmDDvGfDWF52mUMU/eNqLZOFzz1cGEIbTy18BdcpqYz2Ng0TCRUom8Z09UL VxxDFEX/KDCdKKtYexYFMmbEjXmWRFuP26Lej5jF/zrdbve3kZhSc1LR/LU2UZb9SBob k+G0H1TTsLY4rhjuzCeMmL/NXhCWtC1bgDjM5pYYzVDgHT2yGAl4QvjPyuIznfb2pS9Y JVRGj/NYrXdLS9og9noJn1+H7ZS4pZnaz1jIB3WmuQkUgTQF3PEeA8dJIRGxKPNGxkLH g/w8h/3rdHozmCv/a5aZGDv+rnDTSe+ThnBxBIgYZ1qHyeCuhoyLF46kOQGyDxruwdwh JviA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="kOux8/8V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id g2-20020a17090a128200b00273ede74018si2783387pja.187.2023.09.21.19.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 19:15:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="kOux8/8V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 3B2E58119D12; Thu, 21 Sep 2023 11:37:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230250AbjIUShH (ORCPT + 99 others); Thu, 21 Sep 2023 14:37:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbjIUSgh (ORCPT ); Thu, 21 Sep 2023 14:36:37 -0400 Received: from mail-ot1-x34a.google.com (mail-ot1-x34a.google.com [IPv6:2607:f8b0:4864:20::34a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BB91DAFC3 for ; Thu, 21 Sep 2023 11:32:10 -0700 (PDT) Received: by mail-ot1-x34a.google.com with SMTP id 46e09a7af769-6bdb30c45f6so1610644a34.2 for ; Thu, 21 Sep 2023 11:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695321130; x=1695925930; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=mOW1s/LOhiEKmGFQGGQ/gb7iNiCsFWbcKv8d4ZT/dpI=; b=kOux8/8V0qi3LikJmeyi+kgFW4/Yi2d5zbrDwEGQJO45KZK7qlfg5m1hF8N7Cgs8x/ 5aiJdkf+1GwnY4NZROjohnVZVFfS7hjws6FFv9ml5s/HT7h7AxNQGkLI8d9XXDT4RKYH C04uH/JIQpzo/IxM6w63tZuJNU/L7dWeYMBcjkQjlIQ7rzJTe99ZYK8OXiQQ15Rzwn0f CM0I+Q6nazKSdBMgBzkssnBvH+vXBs27mjn89eSPUWqOe8GETrie03zqoif9VCaq6g4P cUeJW4dXt1HBWllPcgMLu8PkjR1vZGKqdcFgL3PYM3jZLIwlGBQQe2ORnlRZMB5Q8IAS JBJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695321130; x=1695925930; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=mOW1s/LOhiEKmGFQGGQ/gb7iNiCsFWbcKv8d4ZT/dpI=; b=TeWsW8iMuIflpav8N2sgNKsk0AM0e3kYf7ObA6jS67lm/rDxO77efQ4EIflSfa7v7m MfrcRbcdnCCA7ebo69g8N+eDeKsWqVMslG0kcey0Z2VV0yndshnWpJ9B8R1vZm3wc37w MHAUR/VVHBO0EfIfqYpbLOXfmv/xjem1y1T8E3ocK/SANDb3/cSMtIcPKByuqkxzVnzp U+/0cGYPZIhw8Nqq0SnBCHAoidzyc8RgUn15WKTDV6Qx0rCn4AmeD85mo52avAXvTRPN z1ZjRKNNAInE9l+k7WIWhluZqIXUoa4w4E9I9M5G3F6ANlVCTzsF6K2Kt00mRCJMIz6p dRvg== X-Gm-Message-State: AOJu0Yzk+KWoOKnETZDebOA5Kpl6ON+XBWIChNmXXs7tbCnMzMRo6NV/ AuNUi3xY9uKRHy84mDl8noTsCKG5+yElESWR X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a81:ae59:0:b0:59b:ebe0:9fcd with SMTP id g25-20020a81ae59000000b0059bebe09fcdmr73922ywk.7.1695283861434; Thu, 21 Sep 2023 01:11:01 -0700 (PDT) Date: Thu, 21 Sep 2023 08:10:52 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.459.ge4e396fd5e-goog Message-ID: <20230921081057.3440885-1-yosryahmed@google.com> Subject: [PATCH 0/5] mm: memcg: subtree stats flushing and thresholds From: Yosry Ahmed To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Ivan Babrou , Tejun Heo , "=?UTF-8?q?Michal=20Koutn=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, Yosry Ahmed Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.2 required=5.0 tests=DATE_IN_PAST_06_12, DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Thu, 21 Sep 2023 11:37:15 -0700 (PDT) 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 v2 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/ 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 | 37 +++-- 4 files changed, 181 insertions(+), 135 deletions(-) -- 2.42.0.459.ge4e396fd5e-goog