Skip to content

Commit 84b12b7

Browse files
rmullickpaulmck
authored andcommitted
rcu: Remove have_rcu_nocb_mask from tree_plugin.h
Currently have_rcu_nocb_mask is used to avoid double allocation of rcu_nocb_mask during boot up. Due to different representation of cpumask_var_t on different kernel config CPUMASK=y(or n) it was okay. But now we have a helper cpumask_available(), which can be utilized to check whether rcu_nocb_mask has been allocated or not without using a variable. Removing the variable also reduces vmlinux size. Unpatched version: text data bss dec hex filename 13050393 7852470 14543408 35446271 21cddff vmlinux Patched version: text data bss dec hex filename 13050390 7852438 14543408 35446236 21cdddc vmlinux Signed-off-by: Rakib Mullick <[email protected]> Cc: "Paul E. McKenney" <[email protected]> Cc: Josh Triplett <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Lai Jiangshan <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent efd88b0 commit 84b12b7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

kernel/rcu/tree_plugin.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ DEFINE_PER_CPU(char, rcu_cpu_has_work);
6161

6262
#ifdef CONFIG_RCU_NOCB_CPU
6363
static cpumask_var_t rcu_nocb_mask; /* CPUs to have callbacks offloaded. */
64-
static bool have_rcu_nocb_mask; /* Was rcu_nocb_mask allocated? */
6564
static bool __read_mostly rcu_nocb_poll; /* Offload kthread are to poll. */
6665
#endif /* #ifdef CONFIG_RCU_NOCB_CPU */
6766

@@ -1752,7 +1751,6 @@ static void increment_cpu_stall_ticks(void)
17521751
static int __init rcu_nocb_setup(char *str)
17531752
{
17541753
alloc_bootmem_cpumask_var(&rcu_nocb_mask);
1755-
have_rcu_nocb_mask = true;
17561754
cpulist_parse(str, rcu_nocb_mask);
17571755
return 1;
17581756
}
@@ -1801,7 +1799,7 @@ static void rcu_init_one_nocb(struct rcu_node *rnp)
18011799
/* Is the specified CPU a no-CBs CPU? */
18021800
bool rcu_is_nocb_cpu(int cpu)
18031801
{
1804-
if (have_rcu_nocb_mask)
1802+
if (cpumask_available(rcu_nocb_mask))
18051803
return cpumask_test_cpu(cpu, rcu_nocb_mask);
18061804
return false;
18071805
}
@@ -2295,14 +2293,13 @@ void __init rcu_init_nohz(void)
22952293
need_rcu_nocb_mask = true;
22962294
#endif /* #if defined(CONFIG_NO_HZ_FULL) */
22972295

2298-
if (!have_rcu_nocb_mask && need_rcu_nocb_mask) {
2296+
if (!cpumask_available(rcu_nocb_mask) && need_rcu_nocb_mask) {
22992297
if (!zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL)) {
23002298
pr_info("rcu_nocb_mask allocation failed, callback offloading disabled.\n");
23012299
return;
23022300
}
2303-
have_rcu_nocb_mask = true;
23042301
}
2305-
if (!have_rcu_nocb_mask)
2302+
if (!cpumask_available(rcu_nocb_mask))
23062303
return;
23072304

23082305
#if defined(CONFIG_NO_HZ_FULL)
@@ -2428,7 +2425,7 @@ static void __init rcu_organize_nocb_kthreads(struct rcu_state *rsp)
24282425
struct rcu_data *rdp_leader = NULL; /* Suppress misguided gcc warn. */
24292426
struct rcu_data *rdp_prev = NULL;
24302427

2431-
if (!have_rcu_nocb_mask)
2428+
if (!cpumask_available(rcu_nocb_mask))
24322429
return;
24332430
if (ls == -1) {
24342431
ls = int_sqrt(nr_cpu_ids);

0 commit comments

Comments
 (0)