Skip to contentSkip to conversation

sched/topology: fix percpu in struct sd_data & struct s_data

PATCH New Luc Van Oostenryck 2 participants 2 messages Jan 18, 2019 – Feb 11, 2019 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/topology: fix percpu in struct sd_data & struct s_data

The percpu members of these structure are declared as:

	struct ... ** __percpu member;

So their type is:
__percpu pointer to pointer to struct ...

But looking at how they're used, their type should be:
pointer to __percpu pointer to struct ...
and they should thus be declared as:

	struct ... * __percpu *member;

So fix the placement of '__percpu' in the definition of these structures.

This silents a bunch of Sparse's warnings like:
warning: incorrect type in initializer (different address spaces)
expected void const [noderef] <asn:3> *__vpp_verify got struct sched_domain **

---
 include/linux/sched/topology.h | 8 ++++----
 kernel/sched/topology.c        | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
include/linux/sched/topology.h +4 -4
index c31d3a47a..57c7ed3fe 100644
@@ -176,10 +176,10 @@ typedef int (*sched_domain_flags_f)(void);
 #define SDTL_OVERLAP	0x01
 
 struct sd_data {
-	struct sched_domain **__percpu sd;
-	struct sched_domain_shared **__percpu sds;
-	struct sched_group **__percpu sg;
-	struct sched_group_capacity **__percpu sgc;
+	struct sched_domain *__percpu *sd;
+	struct sched_domain_shared *__percpu *sds;
+	struct sched_group *__percpu *sg;
+	struct sched_group_capacity *__percpu *sgc;
 };
 
 struct sched_domain_topology_level {
kernel/sched/topology.c +1 -1
index 3f35ba1d8..efca2489d 100644
@@ -676,7 +676,7 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
 }
 
 struct s_data {
-	struct sched_domain ** __percpu sd;
+	struct sched_domain * __percpu *sd;
 	struct root_domain	*rd;
 };
 
Signature · 1 line
2.20.0
#1 lore raw

[tip:sched/core] sched/topology: Fix percpu data types in struct sd_data & struct s_data

sched/topology: Fix percpu data types in struct sd_data & struct s_data
Commit-ID:  99687cdbb3f6c8e32bcc7f37496e811f30460e48
Gitweb:     https://git.kernel.org/tip/99687cdbb3f6c8e32bcc7f37496e811f30460e48
Author:     Luc Van Oostenryck <[email protected]>
AuthorDate: Fri, 18 Jan 2019 15:49:36 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 11 Feb 2019 08:02:15 +0100

sched/topology: Fix percpu data types in struct sd_data & struct s_data

The percpu members of struct sd_data and s_data are declared as:

	struct ... ** __percpu member;

So their type is:

__percpu pointer to pointer to struct ...

But looking at how they're used, their type should be:

pointer to __percpu pointer to struct ...

and they should thus be declared as:

	struct ... * __percpu *member;

So fix the placement of '__percpu' in the definition of these structures.

This addresses a bunch of Sparse's warnings like:

warning: incorrect type in initializer (different address spaces)
expected void const [noderef] <asn:3> *__vpp_verify got struct sched_domain **

---
 include/linux/sched/topology.h | 8 ++++----
 kernel/sched/topology.c        | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
include/linux/sched/topology.h +4 -4
index c31d3a47a47c..57c7ed3fe465 100644
@@ -176,10 +176,10 @@ typedef int (*sched_domain_flags_f)(void);
 #define SDTL_OVERLAP	0x01
 
 struct sd_data {
-	struct sched_domain **__percpu sd;
-	struct sched_domain_shared **__percpu sds;
-	struct sched_group **__percpu sg;
-	struct sched_group_capacity **__percpu sgc;
+	struct sched_domain *__percpu *sd;
+	struct sched_domain_shared *__percpu *sds;
+	struct sched_group *__percpu *sg;
+	struct sched_group_capacity *__percpu *sgc;
 };
 
 struct sched_domain_topology_level {
kernel/sched/topology.c +1 -1
index 4ae9403420ed..93ff526e77b0 100644
@@ -705,7 +705,7 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
 }
 
 struct s_data {
-	struct sched_domain ** __percpu sd;
+	struct sched_domain * __percpu *sd;
 	struct root_domain	*rd;
 };