From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
To: linux-kernel@vger.kernel.org, rcu@vger.kernel.org
Cc: Joel Fernandes <joel@joelfernandes.org>, paulmck@linux.ibm.com
Subject: [RFC 4/5] sched/toplogy: Use smp_store_release() instead of rcu_assign_pointer
Date: Tue, 19 Feb 2019 23:08:26 -0500 [thread overview]
Message-ID: <20190220040827.136184-5-joel@joelfernandes.org> (raw)
In-Reply-To: <20190220040827.136184-1-joel@joelfernandes.org>
From: Joel Fernandes <joel@joelfernandes.org>
The scheduler's topology code seems to want to use rcu_assign_pointer()
to initialize various pointers for no apparent reason.
With a guess that what was needed here is smp_store_release(), I am
replacing it with that. This suppresses the new sparse errors caused by
an annotation check I added to rcu_assign_pointer(). Let us avoid (ab)using
RCU API and be explicit about what we want.
Fixes sparse errors:
kernel//sched/topology.c:206:1: sparse: warning: symbol
'sched_energy_mutex' was not declared. Should it be static?
kernel//sched/topology.c:207:6: sparse: warning: symbol
'sched_energy_update' was not declared. Should it be static? >>
kernel//sched/topology.c:378:9: sparse: error: incompatible types in
comparison expression (different address spaces)
kernel//sched/topology.c:387:9: sparse: error: incompatible types in
comparison expression (different address spaces)
kernel//sched/topology.c:612:9: sparse: error: incompatible types in
comparison expression (different address spaces)
kernel//sched/topology.c:615:9: sparse: error: incompatible types in
comparison expression (different address spaces)
kernel//sched/topology.c:618:9: sparse: error: incompatible types in
comparison expression (different address spaces)
kernel//sched/topology.c:621:9: sparse: error: incompatible types in
comparison expression (different address spaces)
Signed-off-by: Joel Fernandes <joel@joelfernandes.org>
---
kernel/sched/topology.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 3f35ba1d8fde..e7a424d8de8e 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -375,7 +375,7 @@ static bool build_perf_domains(const struct cpumask *cpu_map)
/* Attach the new list of performance domains to the root domain. */
tmp = rd->pd;
- rcu_assign_pointer(rd->pd, pd);
+ smp_store_release(&rd->pd, pd);
if (tmp)
call_rcu(&tmp->rcu, destroy_perf_domain_rcu);
@@ -384,7 +384,7 @@ static bool build_perf_domains(const struct cpumask *cpu_map)
free:
free_pd(pd);
tmp = rd->pd;
- rcu_assign_pointer(rd->pd, NULL);
+ smp_store_release(&rd->pd, NULL);
if (tmp)
call_rcu(&tmp->rcu, destroy_perf_domain_rcu);
@@ -609,19 +609,19 @@ static void update_top_cache_domain(int cpu)
sds = sd->shared;
}
- rcu_assign_pointer(per_cpu(sd_llc, cpu), sd);
+ smp_store_release(&per_cpu(sd_llc, cpu), sd);
per_cpu(sd_llc_size, cpu) = size;
per_cpu(sd_llc_id, cpu) = id;
- rcu_assign_pointer(per_cpu(sd_llc_shared, cpu), sds);
+ smp_store_release(&per_cpu(sd_llc_shared, cpu), sds);
sd = lowest_flag_domain(cpu, SD_NUMA);
- rcu_assign_pointer(per_cpu(sd_numa, cpu), sd);
+ smp_store_release(&per_cpu(sd_numa, cpu), sd);
sd = highest_flag_domain(cpu, SD_ASYM_PACKING);
- rcu_assign_pointer(per_cpu(sd_asym_packing, cpu), sd);
+ smp_store_release(&per_cpu(sd_asym_packing, cpu), sd);
sd = lowest_flag_domain(cpu, SD_ASYM_CPUCAPACITY);
- rcu_assign_pointer(per_cpu(sd_asym_cpucapacity, cpu), sd);
+ smp_store_release(&per_cpu(sd_asym_cpucapacity, cpu), sd);
}
/*
@@ -668,7 +668,7 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
rq_attach_root(rq, rd);
tmp = rq->sd;
- rcu_assign_pointer(rq->sd, sd);
+ smp_store_release(&rq->sd, sd);
dirty_sched_domain_sysctl(cpu);
destroy_sched_domains(tmp);
--
2.21.0.rc0.258.g878e2cd30e-goog
next prev parent reply other threads:[~2019-02-20 4:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 4:08 [RFC 0/5] RCU fixes for rcu_assign_pointer usage Joel Fernandes (Google)
2019-02-20 4:08 ` [RFC 1/5] net: rtnetlink: Fix incorrect RCU API usage Joel Fernandes (Google)
2019-02-20 16:40 ` Paul E. McKenney
2019-02-20 18:08 ` Joel Fernandes
2019-02-20 4:08 ` [RFC 2/5] ixgbe: " Joel Fernandes (Google)
2019-02-20 4:08 ` [RFC 3/5] sched/cpufreq: " Joel Fernandes (Google)
2019-02-20 4:08 ` Joel Fernandes (Google) [this message]
2019-02-20 4:08 ` [RFC 5/5] rcuwait: Replace rcu_assign_pointer with smp_store_release Joel Fernandes (Google)
2019-02-20 4:11 ` [RFC 0/5] RCU fixes for rcu_assign_pointer usage Joel Fernandes
2019-02-20 16:42 ` Paul E. McKenney
2019-02-20 18:09 ` Joel Fernandes
2019-02-20 18:28 ` Paul E. McKenney
2019-02-21 16:50 ` Joel Fernandes
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=20190220040827.136184-5-joel@joelfernandes.org \
--to=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.ibm.com \
--cc=rcu@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).