From patchwork Tue Mar 28 22:16:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13191615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B776C77B60 for ; Tue, 28 Mar 2023 22:16:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94B7E6B0074; Tue, 28 Mar 2023 18:16:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 85F016B0075; Tue, 28 Mar 2023 18:16:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D8A56B0078; Tue, 28 Mar 2023 18:16:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5DF376B0074 for ; Tue, 28 Mar 2023 18:16:57 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3985E1A0431 for ; Tue, 28 Mar 2023 22:16:57 +0000 (UTC) X-FDA: 80619718074.27.709234E Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf19.hostedemail.com (Postfix) with ESMTP id 7BED71A0019 for ; Tue, 28 Mar 2023 22:16:55 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=aB5XInM5; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf19.hostedemail.com: domain of 3VmcjZAoKCNkTJNMT5CH98BJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--yosryahmed.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3VmcjZAoKCNkTJNMT5CH98BJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--yosryahmed.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680041815; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kpfCPbcrVlI467nPrWnClcfZlWEh8/oKLk4mWLWwJ5M=; b=vI/r7hl1v/6xo8++ylnOiElA8dxbwEcblEeMwIsvtPyXCYqtKLNzL9xdAnyGltIiJN3jP3 BJwV/pgRmCteRn77+xipgZeT8lRLKjvdIwv9HHleGmKkmiaJQmm9y/6hlt3vIm4H3j2St+ CjuqSXb9UqazUs1iyNaVH3ytjT4CLP4= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=aB5XInM5; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf19.hostedemail.com: domain of 3VmcjZAoKCNkTJNMT5CH98BJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--yosryahmed.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3VmcjZAoKCNkTJNMT5CH98BJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--yosryahmed.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680041815; a=rsa-sha256; cv=none; b=ueFMHOL4jz/fCXzx/h8D3vvACVYuKZyCx+ihbVBORpqK60hGZotPOMdN7WTCffIIBLvgLf JkwfiZvIJGnrQwVy5950VoWbE1O7+Fvt7ux45zUjzd5Om7n8lMUhzXaquo31JtGdVRgqO2 5spp6JtR0AXIR26/AmHPzSJ5zbp1XqQ= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-5461fe3163eso3297007b3.17 for ; Tue, 28 Mar 2023 15:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680041814; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=kpfCPbcrVlI467nPrWnClcfZlWEh8/oKLk4mWLWwJ5M=; b=aB5XInM5shRFEupjVRfOVTwIp8OT/8GOCdpf0mMVeXPooztYFeqB/4fTyYFky42c2L cHJL0WAYSCnTVIPjouGLoaqK+AnedliRs9QJra7EnwTz3y2TYL063GYspGDlo69C/aKX Q4WCP9t0FZSy4z5mYrJKLFahZFndlIErOfAb2mjxfSIGPKnJVKuUODD216rqjI4tCXyS D6OSq62KYNM8d3Y/gjIsH2sn135NHZXDjDoSFmzJ5ShWqmWT9/5W9qO3Eof0i2wwkL4l 11B1AMdH7KMsOMtqPWcbVxPahm2yYwvYDsj0ARVEud+qGQ3Lehzgwg9PonWNXUtgVgTf eH8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680041814; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kpfCPbcrVlI467nPrWnClcfZlWEh8/oKLk4mWLWwJ5M=; b=xnrmXCtnQbeRLecFhb8Ya7ju1vbf9cIv0et6LAXRQlS3377lSQ/Bmq7NiaQe6ZoXYu quahEn/Fhnd8ZcPTOfdhWg4hgG1ALvlk+xuDu1NM2Z5x5Rq0PrzjvtVaPBCJ0WCbJNo5 TKVwHLw/BzKR4MJITvYYHwNXFTKEe/6DQ8yN10TlEQ9lKZON9W8JALmjJDZYDzvJ7YFF f1nXN/NMnbltcRGpXv4kebns2Lh6noHKKbrXqLxMZW033JmGzmzI18cJK1z87k2zg5gq fUoIQfoiXZqe0YZWhp3OVCmqMIRI9MjVcEAprouncUdv07YrGSTkmTMrzX69GgXQMXpW H/+w== X-Gm-Message-State: AAQBX9cjH6ntpLEgMTdP4JujUY1AjJA1RneKiCfkXZfYOyWbYjZUQ0Cf 3j5SbcmS2uXdQJSWjGGIv1GHPgd1uugdZ8Nm X-Google-Smtp-Source: AKy350a5zKI96b1WoEMsf2Uk1BbmTXMpgnT5uYIBtloHj2QDwXA1RiFaSK6WQDs33/Qs1TEwSL1tU23SVOrmYfBj X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a05:6902:1586:b0:b33:531b:3dd4 with SMTP id k6-20020a056902158600b00b33531b3dd4mr8636279ybu.1.1680041814635; Tue, 28 Mar 2023 15:16:54 -0700 (PDT) Date: Tue, 28 Mar 2023 22:16:37 +0000 In-Reply-To: <20230328221644.803272-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20230328221644.803272-1-yosryahmed@google.com> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog Message-ID: <20230328221644.803272-3-yosryahmed@google.com> Subject: [PATCH v2 2/9] memcg: rename mem_cgroup_flush_stats_"delayed" to "ratelimited" From: Yosry Ahmed To: Tejun Heo , Josef Bacik , Jens Axboe , Zefan Li , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , " =?utf-8?q?Michal_Koutn=C3=BD?= " Cc: Vasily Averin , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, Yosry Ahmed X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 7BED71A0019 X-Stat-Signature: oerwh4pw9xbbgwiz97porgi3mqxju75e X-HE-Tag: 1680041815-171651 X-HE-Meta: U2FsdGVkX18i0nZHgMZT7HaMScjQVOxOu1i+qDC3oCaOWJLT3yW5vN/l7k+Hq//Q8pdntEpna31L8so5M/5YsWQHDFeW8s9O33hDf3PGdKrV7PmXNrbR2gNwl74tV7TgHaEk1HUB3I3hTN9xax6lUwZTH+5WrfqFuK1VsV5vY4mPwyGlsKHjlH0yKTtRcfuy4eZ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fcTLJ75UkH9UB2DuksL/CYJiM/L+8N+zKjOGxWq9RTWShLNejvwU/JH0EvfiCQCPjODjgrkd5mW6dEl1Pm9Jhwc8goTxxrmBeYluqn1WGkRcZzM7izMPxnTeHVB7S/UCrkcz+dJAF/LMJnRv/yHeYqFy9vvd2L11g1tI+/4sdznWNd2/pMU0qDOI1oTxLW8XjbVBnn9OvRu8d7lP31CUfbbbVxrbh530e/UgBxLV07mJ6atjXYq0h69P7I5YaOz890GbixzW+S+W780KRuRwlm9VbVA+FN8K+Dh0QDU4FO6ezkSWauwjOto6YYWkbMql42mk6sO2sCBaGDQ8NyqPLPDnrHT8ohXEqFf1Y7PVRq0BqNAzPtig67pjd/4t8p6XqjM4AHc7s0q3xF6kkHOsoNM8X4OjUk9gpHRSdOaUc3eleWnZFNgc5zOjInew4cbpj0MVjr3kPWvTycpKaRVpvZ3PBNNfzHctuKa7zhLzBFVw55A= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: mem_cgroup_flush_stats_delayed() suggests his is using a delayed_work, but this is actually sometimes flushing directly from the callsite. What it's doing is ratelimited calls. A better name would be mem_cgroup_flush_stats_ratelimited(). Suggested-by: Johannes Weiner Signed-off-by: Yosry Ahmed Acked-by: Shakeel Butt Acked-by: Johannes Weiner Acked-by: Michal Hocko --- include/linux/memcontrol.h | 4 ++-- mm/memcontrol.c | 2 +- mm/workingset.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index b6eda2ab205d..ac3f3b3a45e2 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1037,7 +1037,7 @@ static inline unsigned long lruvec_page_state_local(struct lruvec *lruvec, } void mem_cgroup_flush_stats(void); -void mem_cgroup_flush_stats_delayed(void); +void mem_cgroup_flush_stats_ratelimited(void); void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, int val); @@ -1535,7 +1535,7 @@ static inline void mem_cgroup_flush_stats(void) { } -static inline void mem_cgroup_flush_stats_delayed(void) +static inline void mem_cgroup_flush_stats_ratelimited(void) { } diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 0205e58ea430..c3b6aae78901 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -653,7 +653,7 @@ void mem_cgroup_flush_stats(void) __mem_cgroup_flush_stats(); } -void mem_cgroup_flush_stats_delayed(void) +void mem_cgroup_flush_stats_ratelimited(void) { if (time_after64(jiffies_64, flush_next_time)) mem_cgroup_flush_stats(); diff --git a/mm/workingset.c b/mm/workingset.c index 00c6f4d9d9be..af862c6738c3 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -462,7 +462,7 @@ void workingset_refault(struct folio *folio, void *shadow) mod_lruvec_state(lruvec, WORKINGSET_REFAULT_BASE + file, nr); - mem_cgroup_flush_stats_delayed(); + mem_cgroup_flush_stats_ratelimited(); /* * Compare the distance to the existing workingset size. We * don't activate pages that couldn't stay resident even if