diff mbox

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

Message ID cf2ccfc1-a902-29a4-3acf-4025e5172dab@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Waiman Long Oct. 5, 2017, 6:01 p.m. UTC
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 mbox

Patch

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++;
        }