Skip to content

Commit e83e73f

Browse files
author
Paul E. McKenney
committed
rcu/nocb: Leave ->cblist enabled for no-CBs CPUs
As a first step towards making no-CBs CPUs use the ->cblist, this commit leaves the ->cblist enabled for these CPUs. The main reason to make no-CBs CPUs use ->cblist is to take advantage of callback numbering, which will reduce the effects of missed grace periods which in turn will reduce forward-progress problems for no-CBs CPUs. Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
1 parent e6060b4 commit e83e73f

5 files changed

Lines changed: 11 additions & 35 deletions

File tree

‎kernel/rcu/rcu_segcblist.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ void rcu_segcblist_disable(struct rcu_segcblist *rsclp)
7979
*/
8080
void rcu_segcblist_offload(struct rcu_segcblist *rsclp)
8181
{
82-
WARN_ON_ONCE(!rcu_segcblist_empty(rsclp));
83-
WARN_ON_ONCE(rcu_segcblist_n_cbs(rsclp));
84-
WARN_ON_ONCE(rcu_segcblist_n_lazy_cbs(rsclp));
8582
rsclp->offloaded = 1;
8683
}
8784

‎kernel/rcu/rcu_segcblist.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static inline long rcu_segcblist_n_nonlazy_cbs(struct rcu_segcblist *rsclp)
5959

6060
/*
6161
* Is the specified rcu_segcblist enabled, for example, not corresponding
62-
* to an offline or callback-offloaded CPU?
62+
* to an offline CPU?
6363
*/
6464
static inline bool rcu_segcblist_is_enabled(struct rcu_segcblist *rsclp)
6565
{

‎kernel/rcu/tree.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2964,7 +2964,8 @@ rcu_boot_init_percpu_data(int cpu)
29642964
* Initializes a CPU's per-CPU RCU data. Note that only one online or
29652965
* offline event can be happening at a given time. Note also that we can
29662966
* accept some slop in the rsp->gp_seq access due to the fact that this
2967-
* CPU cannot possibly have any RCU callbacks in flight yet.
2967+
* CPU cannot possibly have any non-offloaded RCU callbacks in flight yet.
2968+
* And any offloaded callbacks are being numbered elsewhere.
29682969
*/
29692970
int rcutree_prepare_cpu(unsigned int cpu)
29702971
{
@@ -2978,7 +2979,7 @@ int rcutree_prepare_cpu(unsigned int cpu)
29782979
rdp->n_force_qs_snap = rcu_state.n_force_qs;
29792980
rdp->blimit = blimit;
29802981
if (rcu_segcblist_empty(&rdp->cblist) && /* No early-boot CBs? */
2981-
!init_nocb_callback_list(rdp))
2982+
!rcu_segcblist_is_offloaded(&rdp->cblist))
29822983
rcu_segcblist_init(&rdp->cblist); /* Re-enable callbacks. */
29832984
rdp->dynticks_nesting = 1; /* CPU not up, no tearing. */
29842985
rcu_dynticks_eqs_online();

‎kernel/rcu/tree.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ static void __init rcu_spawn_nocb_kthreads(void);
438438
#ifdef CONFIG_RCU_NOCB_CPU
439439
static void __init rcu_organize_nocb_kthreads(void);
440440
#endif /* #ifdef CONFIG_RCU_NOCB_CPU */
441-
static bool init_nocb_callback_list(struct rcu_data *rdp);
442441
static unsigned long rcu_get_n_cbs_nocb_cpu(struct rcu_data *rdp);
443442
static void rcu_bind_gp_kthread(void);
444443
static bool rcu_nohz_full_cpu(void);

‎kernel/rcu/tree_plugin.h‎

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,6 +2007,7 @@ void __init rcu_init_nohz(void)
20072007
{
20082008
int cpu;
20092009
bool need_rcu_nocb_mask = false;
2010+
struct rcu_data *rdp;
20102011

20112012
#if defined(CONFIG_NO_HZ_FULL)
20122013
if (tick_nohz_full_running && cpumask_weight(tick_nohz_full_mask))
@@ -2040,8 +2041,12 @@ void __init rcu_init_nohz(void)
20402041
if (rcu_nocb_poll)
20412042
pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
20422043

2043-
for_each_cpu(cpu, rcu_nocb_mask)
2044-
init_nocb_callback_list(per_cpu_ptr(&rcu_data, cpu));
2044+
for_each_cpu(cpu, rcu_nocb_mask) {
2045+
rdp = per_cpu_ptr(&rcu_data, cpu);
2046+
if (rcu_segcblist_empty(&rdp->cblist))
2047+
rcu_segcblist_init(&rdp->cblist);
2048+
rcu_segcblist_offload(&rdp->cblist);
2049+
}
20452050
rcu_organize_nocb_kthreads();
20462051
}
20472052

@@ -2167,27 +2172,6 @@ static void __init rcu_organize_nocb_kthreads(void)
21672172
}
21682173
}
21692174

2170-
/* Prevent __call_rcu() from enqueuing callbacks on no-CBs CPUs */
2171-
static bool init_nocb_callback_list(struct rcu_data *rdp)
2172-
{
2173-
if (!rcu_is_nocb_cpu(rdp->cpu))
2174-
return false;
2175-
2176-
/* If there are early-boot callbacks, move them to nocb lists. */
2177-
if (!rcu_segcblist_empty(&rdp->cblist)) {
2178-
rdp->nocb_head = rcu_segcblist_head(&rdp->cblist);
2179-
rdp->nocb_tail = rcu_segcblist_tail(&rdp->cblist);
2180-
atomic_long_set(&rdp->nocb_q_count,
2181-
rcu_segcblist_n_cbs(&rdp->cblist));
2182-
atomic_long_set(&rdp->nocb_q_count_lazy,
2183-
rcu_segcblist_n_lazy_cbs(&rdp->cblist));
2184-
}
2185-
rcu_segcblist_init(&rdp->cblist);
2186-
rcu_segcblist_disable(&rdp->cblist);
2187-
rcu_segcblist_offload(&rdp->cblist);
2188-
return true;
2189-
}
2190-
21912175
/*
21922176
* Bind the current task to the offloaded CPUs. If there are no offloaded
21932177
* CPUs, leave the task unbound. Splat if the bind attempt fails.
@@ -2263,11 +2247,6 @@ static void __init rcu_spawn_nocb_kthreads(void)
22632247
{
22642248
}
22652249

2266-
static bool init_nocb_callback_list(struct rcu_data *rdp)
2267-
{
2268-
return false;
2269-
}
2270-
22712250
static unsigned long rcu_get_n_cbs_nocb_cpu(struct rcu_data *rdp)
22722251
{
22732252
return 0;

0 commit comments

Comments
 (0)