From: Sasha Levin Date: Wed, 3 Jun 2020 14:29:20 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v5.7.1~32 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=19681de1e6d373e5c07eb8c706d3b001fbafbc23;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/revert-cgroup-add-memory-barriers-to-plug-cgroup_rst.patch b/queue-5.4/revert-cgroup-add-memory-barriers-to-plug-cgroup_rst.patch new file mode 100644 index 00000000000..8857e37c672 --- /dev/null +++ b/queue-5.4/revert-cgroup-add-memory-barriers-to-plug-cgroup_rst.patch @@ -0,0 +1,74 @@ +From 770c263d22402a4d34e64f0296a02467b0d4260b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Apr 2020 14:55:35 -0400 +Subject: Revert "cgroup: Add memory barriers to plug cgroup_rstat_updated() + race window" + +From: Tejun Heo + +[ Upstream commit d8ef4b38cb69d907f9b0e889c44d05fc0f890977 ] + +This reverts commit 9a9e97b2f1f2 ("cgroup: Add memory barriers to plug +cgroup_rstat_updated() race window"). + +The commit was added in anticipation of memcg rstat conversion which needed +synchronous accounting for the event counters (e.g. oom kill count). However, +the conversion didn't get merged due to percpu memory overhead concern which +couldn't be addressed at the time. + +Unfortunately, the patch's addition of smp_mb() to cgroup_rstat_updated() +meant that every scheduling event now had to go through an additional full +barrier and Mel Gorman noticed it as 1% regression in netperf UDP_STREAM test. + +There's no need to have this barrier in tree now and even if we need +synchronous accounting in the future, the right thing to do is separating that +out to a separate function so that hot paths which don't care about +synchronous behavior don't have to pay the overhead of the full barrier. Let's +revert. + +Signed-off-by: Tejun Heo +Reported-by: Mel Gorman +Link: http://lkml.kernel.org/r/20200409154413.GK3818@techsingularity.net +Cc: v4.18+ +Signed-off-by: Sasha Levin +--- + kernel/cgroup/rstat.c | 16 +++------------- + 1 file changed, 3 insertions(+), 13 deletions(-) + +diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c +index ca19b4c8acf5..4a942d4e9763 100644 +--- a/kernel/cgroup/rstat.c ++++ b/kernel/cgroup/rstat.c +@@ -33,12 +33,9 @@ void cgroup_rstat_updated(struct cgroup *cgrp, int cpu) + return; + + /* +- * Paired with the one in cgroup_rstat_cpu_pop_upated(). Either we +- * see NULL updated_next or they see our updated stat. +- */ +- smp_mb(); +- +- /* ++ * Speculative already-on-list test. This may race leading to ++ * temporary inaccuracies, which is fine. ++ * + * Because @parent's updated_children is terminated with @parent + * instead of NULL, we can tell whether @cgrp is on the list by + * testing the next pointer for NULL. +@@ -134,13 +131,6 @@ static struct cgroup *cgroup_rstat_cpu_pop_updated(struct cgroup *pos, + *nextp = rstatc->updated_next; + rstatc->updated_next = NULL; + +- /* +- * Paired with the one in cgroup_rstat_cpu_updated(). +- * Either they see NULL updated_next or we see their +- * updated stat. +- */ +- smp_mb(); +- + return pos; + } + +-- +2.25.1 + diff --git a/queue-5.4/series b/queue-5.4/series new file mode 100644 index 00000000000..e44d05ebbc8 --- /dev/null +++ b/queue-5.4/series @@ -0,0 +1 @@ +revert-cgroup-add-memory-barriers-to-plug-cgroup_rst.patch