Message ID | 20231129032154.3710765-2-yosryahmed@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 0A2D6C4167B for <linux-mm@archiver.kernel.org>; Wed, 29 Nov 2023 03:28:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 955AA6B03A0; Tue, 28 Nov 2023 22:28:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E0336B03A2; Tue, 28 Nov 2023 22:28:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77EEB6B03A3; Tue, 28 Nov 2023 22:28:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 637FF6B03A0 for <linux-mm@kvack.org>; Tue, 28 Nov 2023 22:28:36 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 317F5C03BE for <linux-mm@kvack.org>; Wed, 29 Nov 2023 03:28:36 +0000 (UTC) X-FDA: 81509559432.07.FAD53BA Received: from mail-oo1-f73.google.com (mail-oo1-f73.google.com [209.85.161.73]) by imf01.hostedemail.com (Postfix) with ESMTP id 7854E40015 for <linux-mm@kvack.org>; Wed, 29 Nov 2023 03:28:34 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="V/7KoWtW"; spf=pass (imf01.hostedemail.com: domain of 3Wq5mZQoKCIM5vzy5hotlknvvnsl.jvtspu14-ttr2hjr.vyn@flex--yosryahmed.bounces.google.com designates 209.85.161.73 as permitted sender) smtp.mailfrom=3Wq5mZQoKCIM5vzy5hotlknvvnsl.jvtspu14-ttr2hjr.vyn@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701228514; 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=fp/riADQZ1JFvdRujo1i1RQ8s//WQnrX4uDVuQ0rm8w=; b=SeMXFOFDnP+7/CJcwYqaPtY5mJ7XazONUwkwsuPXjSjctHx/lWqh589Iu7I4O10DfR6m1o Qo4SjOziMxTqdnqLwfp5YBqlWXVaL1uv2uihwSEPRlwb08RBDYgD1EYskBUT22G3steefa KRvJCl8INPanKss5/kDp6gINT3t+HyA= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="V/7KoWtW"; spf=pass (imf01.hostedemail.com: domain of 3Wq5mZQoKCIM5vzy5hotlknvvnsl.jvtspu14-ttr2hjr.vyn@flex--yosryahmed.bounces.google.com designates 209.85.161.73 as permitted sender) smtp.mailfrom=3Wq5mZQoKCIM5vzy5hotlknvvnsl.jvtspu14-ttr2hjr.vyn@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701228514; a=rsa-sha256; cv=none; b=AsU3etZH5JUN7HahAPKCYtz+gEBJdhOsFB6sweIjwC6mTIEVtQ0VygkPit3eiYqtSxEyDE m4qDAoPUgKYzUBgl0osYzeKEGmhadBiV9ri59jaTgh/q7hsPoKo2XSAG9TiQw0tAOmHHha e/m991vQIshG72NVcS2DTi9zNqNPfv4= Received: by mail-oo1-f73.google.com with SMTP id 006d021491bc7-58a91cf3f97so6780309eaf.0 for <linux-mm@kvack.org>; Tue, 28 Nov 2023 19:28:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701228513; x=1701833313; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=fp/riADQZ1JFvdRujo1i1RQ8s//WQnrX4uDVuQ0rm8w=; b=V/7KoWtWpTkhFUCxccDG6EqQwGTOYn6QUZKSwQXyxALrcfqHqFPQyAB7G5EQcHHouE 4cZ5nyvPkEzzwYgxNM04ulDvRjq+i+Qc8ZrK3IfzkaG1JG/jwZznJ4UVoTYX60CcoGM9 VLkD44K+gvSHZjdAqy1IkNZytBUOVTX0PqHsQhQ8iBfSCwlE4gDUmCovhtFYXwvYZNCh xEqqrjFL/8jLO/nagIheEvbmAlSgGzB/MmBGw5GIrdOUQVvUWiMhqeFmpoIby30TKIej /yA1naQjEy7lF6ndaxcE4RSsFrQOz9sAy3h6GOMsTfmkzGoCpY66NTzGejc4rXgwO4Ol 4WPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701228513; x=1701833313; 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=fp/riADQZ1JFvdRujo1i1RQ8s//WQnrX4uDVuQ0rm8w=; b=tp/qR4oDsu17dfJvbd2hoEiYH0aVXwLRP3fCDMlT/aDPEe4R/ltxTCK/og2UAI/4hU c4KXz5nJxLBEWrS4f9yNl2eNpz4lNvpzW+Se6ef9i9DB7M03fln7NrARtpjoX8q+DMiv w58j59hRtx6xoSqJR2o+Ta5yr2hrulXSeoWlkpOXHiaEqlpx40T6b5MALmbJTMyYbOB0 2snTk0uDEj4DqC4A5QspLCZccN7dRRxY5UUBroMB5hRHT4Ke79T4zdNjsPWqE3/2nmtp J0wHR527t5bhJycBfLcZWNeOyanVb9vKggQMdMMOWxPDIoaAsU0HCKit91ABG1TwFN2s fuiQ== X-Gm-Message-State: AOJu0Yx/Qy8pamAqic6doAfVeWNMNtGtbvYcibX3Kg5Dfr2l165HQ25p nJ0rMKT/v6CMwVkEDptPXMpSOZguV5YZ+Hff X-Google-Smtp-Source: AGHT+IF7CgJpm4ll7+nN91xVmCbgACzK5L5zzJqDfVPl2iyh6TzmkcueFovPIrPdqybEYEo2dnecWek0ZhORplj8 X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a05:690c:989:b0:59b:ca80:919a with SMTP id ce9-20020a05690c098900b0059bca80919amr510184ywb.0.1701228122771; Tue, 28 Nov 2023 19:22:02 -0800 (PST) Date: Wed, 29 Nov 2023 03:21:49 +0000 In-Reply-To: <20231129032154.3710765-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20231129032154.3710765-1-yosryahmed@google.com> X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog Message-ID: <20231129032154.3710765-2-yosryahmed@google.com> Subject: [mm-unstable v4 1/5] mm: memcg: change flush_next_time to flush_last_time From: Yosry Ahmed <yosryahmed@google.com> To: Andrew Morton <akpm@linux-foundation.org> Cc: Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>, Roman Gushchin <roman.gushchin@linux.dev>, Shakeel Butt <shakeelb@google.com>, Muchun Song <muchun.song@linux.dev>, Ivan Babrou <ivan@cloudflare.com>, Tejun Heo <tj@kernel.org>, " =?utf-8?q?Michal_Koutn=C3=BD?= " <mkoutny@suse.com>, Waiman Long <longman@redhat.com>, kernel-team@cloudflare.com, Wei Xu <weixugc@google.com>, Greg Thelen <gthelen@google.com>, Domenico Cerasuolo <cerasuolodomenico@gmail.com>, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Yosry Ahmed <yosryahmed@google.com>, Chris Li <chrisl@kernel.org> Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 7854E40015 X-Rspam-User: X-Stat-Signature: 955n9nc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9/9W0BFgeOBXZM3D8thG/QjDO7VCMkdB0nwjBsIPn6ast6cXVd6OTR+Km7+Huac894tl5wwd4Zm9dDtbOIjKrXu1b2lp3e/v1xxbbxlDUhAh/o0kx4VvidpcfeBnwcIKTuDjzfuoNs5f8yv1CK1Yna8bkPxKyqVP8xTeVIuck6ht29YIC1I9Tf4r8i51UArsmWTvOK7QhgtZ/HpJlUCx1EC0JjluPZrmw3HmYBma8uaxYAfnTF09LLtkN2N+kvAY4TnKpKNmXhm3k7v65zKL2amOOFDCEvb15Y5FZoTAzCpRXQb4eJvWU330CV6+iTsnDCKLPCe69roXISlylNixAt5G0o/g90hvZ8vhpuF+G+b2YloXAu69W+Ca/si2X2q0//G4h9QYQ8pzWWlQ50Z8yviIZbfhzPNjLGNJKKu0rRTkFmHJe7AO4bau8Lx4cbn5p0WVc+O+dMqvZONo3MrzcyvvkTzlwDkyMb2Oqi7haoU6Xm372a3Afta7I+GykM9ARhAIGHFfifAFt5OR2ACSC96+kfOoTyBt7hTe5Xd2wVdCnOBBy/o1/skRsr9cKWZEcCSRTVaxM9ZBaExhRYcnCcr0owzrhnn7zDMTelrmy1ELLXdjnM3lUqWDR/B/0dSqxTH75ohUzBkXGbO6ixIMGefvhBpUQG8o2M8hgM66L4Yty8YnkH9ub8Ia8oLzG3lrxKEMN44mxr+nkaNSFsv8d/G81duyUYcL2lOJWNw0ipMjz5iNzqGpr6XsPpA= 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm: memcg: subtree stats flushing and thresholds
|
expand
|
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index f88c8fd036897..61435bd037cb4 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -593,7 +593,7 @@ static DECLARE_DEFERRABLE_WORK(stats_flush_dwork, flush_memcg_stats_dwork); static DEFINE_PER_CPU(unsigned int, stats_updates); static atomic_t stats_flush_ongoing = ATOMIC_INIT(0); static atomic_t stats_flush_threshold = ATOMIC_INIT(0); -static u64 flush_next_time; +static u64 flush_last_time; #define FLUSH_TIME (2UL*HZ) @@ -653,7 +653,7 @@ static void do_flush_stats(void) atomic_xchg(&stats_flush_ongoing, 1)) return; - WRITE_ONCE(flush_next_time, jiffies_64 + 2*FLUSH_TIME); + WRITE_ONCE(flush_last_time, jiffies_64); cgroup_rstat_flush(root_mem_cgroup->css.cgroup); @@ -669,7 +669,8 @@ void mem_cgroup_flush_stats(void) void mem_cgroup_flush_stats_ratelimited(void) { - if (time_after64(jiffies_64, READ_ONCE(flush_next_time))) + /* Only flush if the periodic flusher is one full cycle late */ + if (time_after64(jiffies_64, READ_ONCE(flush_last_time) + 2*FLUSH_TIME)) mem_cgroup_flush_stats(); }