hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/drivers/md/raid5.c
....@@ -2069,8 +2069,9 @@
20692069 struct raid5_percpu *percpu;
20702070 unsigned long cpu;
20712071
2072
- cpu = get_cpu();
2072
+ cpu = get_cpu_light();
20732073 percpu = per_cpu_ptr(conf->percpu, cpu);
2074
+ spin_lock(&percpu->lock);
20742075 if (test_bit(STRIPE_OP_BIOFILL, &ops_request)) {
20752076 ops_run_biofill(sh);
20762077 overlap_clear++;
....@@ -2129,7 +2130,8 @@
21292130 if (test_and_clear_bit(R5_Overlap, &dev->flags))
21302131 wake_up(&sh->raid_conf->wait_for_overlap);
21312132 }
2132
- put_cpu();
2133
+ spin_unlock(&percpu->lock);
2134
+ put_cpu_light();
21332135 }
21342136
21352137 static void free_stripe(struct kmem_cache *sc, struct stripe_head *sh)
....@@ -6816,6 +6818,7 @@
68166818 __func__, cpu);
68176819 return -ENOMEM;
68186820 }
6821
+ spin_lock_init(&per_cpu_ptr(conf->percpu, cpu)->lock);
68196822 return 0;
68206823 }
68216824
....@@ -6826,7 +6829,6 @@
68266829 conf->percpu = alloc_percpu(struct raid5_percpu);
68276830 if (!conf->percpu)
68286831 return -ENOMEM;
6829
-
68306832 err = cpuhp_state_add_instance(CPUHP_MD_RAID5_PREPARE, &conf->node);
68316833 if (!err) {
68326834 conf->scribble_disks = max(conf->raid_disks,