Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1378149
| From | Waiman Long <waiman.long@hpe.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks |
| Date | 2016-04-13 20:00 +0200 |
| Message-ID | <rnxf6-4Yd-31@gated-at.bofh.it> (permalink) |
| References | <rnfrQ-72b-15@gated-at.bofh.it> <rnfBw-7qw-15@gated-at.bofh.it> <rnizn-1kR-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 04/12/2016 10:09 PM, Boqun Feng wrote:
> Hi Waiman,
>
> On Tue, Apr 12, 2016 at 06:54:43PM -0400, Waiman Long wrote:
> [...]
>> +
>> +/*
>> + * Initialize the per-cpu list head
>> + */
>> +int init_pcpu_list_head(struct pcpu_list_head **ppcpu_head)
>> +{
>> + struct pcpu_list_head *pcpu_head = alloc_percpu(struct pcpu_list_head);
>> + int cpu;
>> +
>> + if (!pcpu_head)
>> + return -ENOMEM;
>> +
>> + for_each_possible_cpu(cpu) {
>> + struct pcpu_list_head *head = per_cpu_ptr(pcpu_head, cpu);
>> +
>> + INIT_LIST_HEAD(&head->list);
>> + head->lock = __SPIN_LOCK_UNLOCKED(&head->lock);
>> + lockdep_set_class(&head->lock,&percpu_list_key);
>> + }
>> +
>> + *ppcpu_head = pcpu_head;
>> + return 0;
>> +}
> The first time I looked at this patch, I had a hard time to figure out
> which "struct pcpu_list_head" pointer is pointing to percpu data(the
> pointer could be the parameter for per/this_cpu_ptr()), and which
> pointer is pointing to actual structure. For example, 'pcpu_head' and
> 'head' above are different types of pointers.
>
> So besides improving my code reading skills, I think the following patch
> helps ;-) Also it can resolve several splats of sparse when running
> 'make C=1 lib/'.
>
> Thoughts?
Yes, I think your patch is helpful. I will include your patch in my
patchset.
Thanks,
Longman
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v7 0/4] vfs: Use per-cpu list for SB's s_inodes list Waiman Long <Waiman.Long@hpe.com> - 2016-04-13 01:00 +0200
[PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks Waiman Long <Waiman.Long@hpe.com> - 2016-04-13 01:10 +0200
Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks Boqun Feng <boqun.feng@gmail.com> - 2016-04-13 04:20 +0200
Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks Waiman Long <waiman.long@hpe.com> - 2016-04-13 20:00 +0200
Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks Boqun Feng <boqun.feng@gmail.com> - 2016-04-15 01:40 +0200
Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks Christoph Lameter <cl@linux.com> - 2016-04-13 17:10 +0200
Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks Waiman Long <waiman.long@hpe.com> - 2016-04-13 19:50 +0200
Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks Christoph Lameter <cl@linux.com> - 2016-04-13 20:10 +0200
Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks Jan Kara <jack@suse.cz> - 2016-04-14 16:20 +0200
Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks Waiman Long <waiman.long@hpe.com> - 2016-04-14 20:50 +0200
csiph-web