[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <578FF50E.8030503@hpe.com>
Date: Wed, 20 Jul 2016 18:02:54 -0400
From: Waiman Long <waiman.long@....com>
To: Tejun Heo <tj@...nel.org>
CC: Alexander Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.com>,
Jeff Layton <jlayton@...chiereds.net>,
"J. Bruce Fields" <bfields@...ldses.org>,
Christoph Lameter <cl@...ux-foundation.org>,
<linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Andi Kleen <andi@...stfloor.org>,
Dave Chinner <dchinner@...hat.com>,
Boqun Feng <boqun.feng@...il.com>,
Scott J Norton <scott.norton@....com>,
Douglas Hatch <doug.hatch@....com>
Subject: Re: [PATCH v3 1/4] lib/dlock-list: Distributed and lock-protected
lists
On 07/19/2016 03:23 PM, Tejun Heo wrote:
> Hello,
>
> On Tue, Jul 19, 2016 at 02:42:31PM -0400, Waiman Long wrote:
>>>> +int alloc_dlock_list_head(struct dlock_list_head *dlist)
>>>> +{
>>>> + 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;
>>> Just use dlist->head directly or use local __perpcu head pointer?
>> I just don't want to expose the structure to world until it is fully
>> initialized. If you think I am over-cautious, I can use dlist->head as
>> suggested.
> I don't think it makes any actual difference. No strong opinion
> either way. Just use local __percpu head pointer then?
I have run sparse on dlock_list.c. There is no need to use the __percpu
tag here. The head gets assigned the result of per_cpu_ptr() which has
no __percpu annotation. I actually got sparse warning if I used the
__percpu tag.
Cheers,
Longman
Powered by blists - more mailing lists