Re: [PATCH v6 4/6] lib/dlock-list: Make sibling CPUs share the same linked list

From: Waiman Long
Date: Thu Oct 05 2017 - 14:01:41 EST


On 10/05/2017 01:40 PM, Davidlohr Bueso wrote:
> This is still spitting:
>
> lib/dlock-list.c: In function ÃâËcpu2idx_initÃââ:
> lib/dlock-list.c:75:16: error: incompatible types when assigning to
> type ÃâËcpumask_var_tÃââ from type ÃâËstruct cpumask *Ãââ
> sibling_mask = topology_sibling_cpumask(cpu);
> ^
> lib/dlock-list.c:76:7: warning: the address of ÃâËsibling_maskÃââ will
> always evaluate as ÃâËtrueÃââ [-Waddress]
> if (sibling_mask) {
> ^


Thanks for reporting this problem. Dealing with cpumask is always
tricky. Could you try the following patch to see if it could fix the
problem.

Thanks,
Longman

----------------------------------------------------

diff --git a/lib/dlock-list.c b/lib/dlock-list.c
index f0df7d5..3afd76d 100644
--- a/lib/dlock-list.c
+++ b/lib/dlock-list.c
@@ -60,7 +60,7 @@
static int __init cpu2idx_init(void)
{
int idx, cpu;
- cpumask_var_t sibling_mask;
+ struct cpumask *sibling_mask;
static struct cpumask mask __initdata;

cpumask_clear(&mask);
@@ -74,11 +74,9 @@ static int __init cpu2idx_init(void)
cpumask_set_cpu(cpu, &mask);

sibling_mask = topology_sibling_cpumask(cpu);
- if (sibling_mask) {
- for_each_cpu(scpu, sibling_mask) {
- per_cpu(cpu2idx, scpu) = idx;
- cpumask_set_cpu(scpu, &mask);
- }
+ for_each_cpu(scpu, sibling_mask) {
+ per_cpu(cpu2idx, scpu) = idx;
+ cpumask_set_cpu(scpu, &mask);
}
idx++;
}