Hello,
On Tue, Jul 19, 2016 at 02:42:31PM -0400, Waiman Long wrote:
I don't think it makes any actual difference. No strong opinionI just don't want to expose the structure to world until it is fully+int alloc_dlock_list_head(struct dlock_list_head *dlist)Just use dlist->head directly or use local __perpcu head pointer?
+{
+ struct dlock_list_head dlist_tmp;
+ int cpu;
+
+ dlist_tmp.head = alloc_percpu(struct dlock_list_head_percpu);
+ if (!dlist_tmp.head)
+ return -ENOMEM;
+
+ for_each_possible_cpu(cpu) {
+ struct dlock_list_head_percpu *head;
+
+ head = per_cpu_ptr(dlist_tmp.head, cpu);
+ INIT_LIST_HEAD(&head->list);
+ head->lock = __SPIN_LOCK_UNLOCKED(&head->lock);
+ lockdep_set_class(&head->lock,&dlock_list_key);
+ }
+
+ dlist->head = dlist_tmp.head;
initialized. If you think I am over-cautious, I can use dlist->head as
suggested.
either way. Just use local __percpu head pointer then?