From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org, tj@kernel.org, shakeelb@google.com,
roman.gushchin@linux.dev, muchun.song@linux.dev,
mkoutny@suse.com, mhocko@kernel.org, longman@redhat.com,
ivan@cloudflare.com, hannes@cmpxchg.org, yosryahmed@google.com,
akpm@linux-foundation.org
Subject: + mm-memcg-add-a-helper-for-non-unified-stats-flushing.patch added to mm-unstable branch
Date: Sat, 02 Sep 2023 16:28:46 -0700 [thread overview]
Message-ID: <20230902232846.DE7F5C433C8@smtp.kernel.org> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4277 bytes --]
The patch titled
Subject: mm: memcg: add a helper for non-unified stats flushing
has been added to the -mm mm-unstable branch. Its filename is
mm-memcg-add-a-helper-for-non-unified-stats-flushing.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-memcg-add-a-helper-for-non-unified-stats-flushing.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Yosry Ahmed <yosryahmed@google.com>
Subject: mm: memcg: add a helper for non-unified stats flushing
Date: Thu, 31 Aug 2023 16:56:09 +0000
Some contexts flush memcg stats outside of unified flushing, directly
using cgroup_rstat_flush(). Add a helper for non-unified flushing, a
counterpart for do_unified_stats_flush(), and use it in those contexts, as
well as in do_unified_stats_flush() itself.
This abstracts the rstat API and makes it easy to introduce modifications
to either unified or non-unified flushing functions without changing
callers.
No functional change intended.
Link: https://lkml.kernel.org/r/20230831165611.2610118-3-yosryahmed@google.com
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Acked-by: Waiman Long <longman@redhat.com>
Cc: Ivan Babrou <ivan@cloudflare.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Michal Koutný <mkoutny@suse.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/memcontrol.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
--- a/mm/memcontrol.c~mm-memcg-add-a-helper-for-non-unified-stats-flushing
+++ a/mm/memcontrol.c
@@ -640,6 +640,17 @@ static inline void memcg_rstat_updated(s
}
/*
+ * do_stats_flush - do a flush of the memory cgroup statistics
+ * @memcg: memory cgroup to flush
+ *
+ * Only flushes the subtree of @memcg, does not skip under any conditions.
+ */
+static void do_stats_flush(struct mem_cgroup *memcg)
+{
+ cgroup_rstat_flush(memcg->css.cgroup);
+}
+
+/*
* do_unified_stats_flush - do a unified flush of memory cgroup statistics
*
* A unified flush tries to flush the entire hierarchy, but skips if there is
@@ -656,7 +667,7 @@ static void do_unified_stats_flush(void)
WRITE_ONCE(flush_next_time, jiffies_64 + 2*FLUSH_TIME);
- cgroup_rstat_flush(root_mem_cgroup->css.cgroup);
+ do_stats_flush(root_mem_cgroup);
atomic_set(&stats_flush_threshold, 0);
atomic_set(&stats_unified_flush_ongoing, 0);
@@ -7794,7 +7805,7 @@ bool obj_cgroup_may_zswap(struct obj_cgr
break;
}
- cgroup_rstat_flush(memcg->css.cgroup);
+ do_stats_flush(memcg);
pages = memcg_page_state(memcg, MEMCG_ZSWAP_B) / PAGE_SIZE;
if (pages < max)
continue;
@@ -7859,8 +7870,10 @@ void obj_cgroup_uncharge_zswap(struct ob
static u64 zswap_current_read(struct cgroup_subsys_state *css,
struct cftype *cft)
{
- cgroup_rstat_flush(css->cgroup);
- return memcg_page_state(mem_cgroup_from_css(css), MEMCG_ZSWAP_B);
+ struct mem_cgroup *memcg = mem_cgroup_from_css(css);
+
+ do_stats_flush(memcg);
+ return memcg_page_state(memcg, MEMCG_ZSWAP_B);
}
static int zswap_max_show(struct seq_file *m, void *v)
_
Patches currently in -mm which might be from yosryahmed@google.com are
mm-memcg-properly-name-and-document-unified-stats-flushing.patch
mm-memcg-add-a-helper-for-non-unified-stats-flushing.patch
mm-memcg-let-non-unified-root-stats-flushes-help-unified-flushes.patch
mm-memcg-use-non-unified-stats-flushing-for-userspace-reads.patch
reply other threads:[~2023-09-02 23:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230902232846.DE7F5C433C8@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=ivan@cloudflare.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mhocko@kernel.org \
--cc=mkoutny@suse.com \
--cc=mm-commits@vger.kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeelb@google.com \
--cc=tj@kernel.org \
--cc=yosryahmed@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.