+ mm-memcg-restore-subtree-stats-flushing-fix-2.patch added to mm-unstable branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm: memcg: remove stats flushing mutex
has been added to the -mm mm-unstable branch.  Its filename is
     mm-memcg-restore-subtree-stats-flushing-fix-2.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-memcg-restore-subtree-stats-flushing-fix-2.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@xxxxxxxxxx>
Subject: mm: memcg: remove stats flushing mutex
Date: Mon, 4 Dec 2023 23:43:29 +0000

The mutex was intended to make the waiters sleep instead of spin, and such
that we can check the update thresholds again after acquiring the mutex. 
However, the mutex has a risk of priority inversion, especially since the
underlying rstat lock can de dropped while the mutex is held.

Synthetic testing with high concurrency of flushers shows no regressions
without the mutex, so remove it.

Link: https://lkml.kernel.org/r/CAJD7tkZgP3m-VVPn+fF_YuvXeQYK=tZZjJHj=dzD=CcSSpp2qg@xxxxxxxxxxxxxx
Signed-off-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx>
Suggested-by: Shakeel Butt <shakeelb@xxxxxxxxxx>
Acked-by: Shakeel Butt <shakeelb@xxxxxxxxxx>
Cc: Chris Li <chrisl@xxxxxxxxxx>
Cc: Domenico Cerasuolo <cerasuolodomenico@xxxxxxxxx>
Cc: Greg Thelen <gthelen@xxxxxxxxxx>
Cc: Ivan Babrou <ivan@xxxxxxxxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxxxx>
Cc: Michal Koutny <mkoutny@xxxxxxxx>
Cc: Muchun Song <muchun.song@xxxxxxxxx>
Cc: Roman Gushchin <roman.gushchin@xxxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>
Cc: Waiman Long <longman@xxxxxxxxxx>
Cc: Wei Xu <weixugc@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/memcontrol.c |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

--- a/mm/memcontrol.c~mm-memcg-restore-subtree-stats-flushing-fix-2
+++ a/mm/memcontrol.c
@@ -749,21 +749,14 @@ static void do_flush_stats(struct mem_cg
  */
 void mem_cgroup_flush_stats(struct mem_cgroup *memcg)
 {
-	static DEFINE_MUTEX(memcg_stats_flush_mutex);
-
 	if (mem_cgroup_disabled())
 		return;
 
 	if (!memcg)
 		memcg = root_mem_cgroup;
 
-	if (memcg_should_flush_stats(memcg)) {
-		mutex_lock(&memcg_stats_flush_mutex);
-		/* Check again after locking, another flush may have occurred */
-		if (memcg_should_flush_stats(memcg))
-			do_flush_stats(memcg);
-		mutex_unlock(&memcg_stats_flush_mutex);
-	}
+	if (memcg_should_flush_stats(memcg))
+		do_flush_stats(memcg);
 }
 
 void mem_cgroup_flush_stats_ratelimited(struct mem_cgroup *memcg)
_

Patches currently in -mm which might be from yosryahmed@xxxxxxxxxx are

mm-memcg-change-flush_next_time-to-flush_last_time.patch
mm-memcg-move-vmstats-structs-definition-above-flushing-code.patch
mm-memcg-make-stats-flushing-threshold-per-memcg.patch
mm-workingset-move-the-stats-flush-into-workingset_test_recent.patch
mm-memcg-restore-subtree-stats-flushing.patch
mm-memcg-restore-subtree-stats-flushing-fix-2.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux