From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753172AbcDNXeW (ORCPT ); Thu, 14 Apr 2016 19:34:22 -0400 Received: from mail-io0-f175.google.com ([209.85.223.175]:34094 "EHLO mail-io0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753096AbcDNXeT (ORCPT ); Thu, 14 Apr 2016 19:34:19 -0400 Date: Fri, 15 Apr 2016 07:33:34 +0800 From: Boqun Feng To: Waiman Long Cc: Alexander Viro , Jan Kara , Jeff Layton , "J. Bruce Fields" , Tejun Heo , Christoph Lameter , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Andi Kleen , Dave Chinner , Scott J Norton , Douglas Hatch Subject: Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks Message-ID: <20160414233334.GA21026@fixme-laptop.cn.ibm.com> References: <1460501686-37096-1-git-send-email-Waiman.Long@hpe.com> <1460501686-37096-2-git-send-email-Waiman.Long@hpe.com> <20160413020929.GA23058@fixme-laptop.cn.ibm.com> <570E8419.7090909@hpe.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="RnlQjJ0d97Da+TV1" Content-Disposition: inline In-Reply-To: <570E8419.7090909@hpe.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 13, 2016 at 01:38:33PM -0400, Waiman Long wrote: > On 04/12/2016 10:09 PM, Boqun Feng wrote: > > Hi Waiman, > >=20 > > 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 =3D alloc_percpu(struct pcpu_list_= head); > > > + int cpu; > > > + > > > + if (!pcpu_head) > > > + return -ENOMEM; > > > + > > > + for_each_possible_cpu(cpu) { > > > + struct pcpu_list_head *head =3D per_cpu_ptr(pcpu_head, cpu); > > > + > > > + INIT_LIST_HEAD(&head->list); > > > + head->lock =3D __SPIN_LOCK_UNLOCKED(&head->lock); > > > + lockdep_set_class(&head->lock,&percpu_list_key); > > > + } > > > + > > > + *ppcpu_head =3D 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. > >=20 > > 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=3D1 lib/'. > >=20 > > Thoughts? >=20 > Yes, I think your patch is helpful. I will include your patch in my > patchset. >=20 Given that a renaming will happen in the next version, carrying this as a standalone patch will be a pain, I think. So feel free to squash this into the patch #1, if that could make your job eariser ;-) Regards, Boqun > Thanks, > Longman >=20 --RnlQjJ0d97Da+TV1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXECjLAAoJEEl56MO1B/q4jDkH/2MXxiKnkEPrNjiNo0lCZV61 ZBR4klvvZVwiM+A71aoMPGR5oZKpaqqM31QpKxvZ/hxszyx5pWcVUSxglk3JQsTE gnUHNn/mBwAWW3O0x7IWCpx/InmddHpaHZ7wK4uv6YEK7QMT2wDAJhOoTH1KRX42 rM0ai87KazSAL8yHYgXGeUv7N2Bu92LV3v251yYqIMEDf7dhyynzs1ME1VsK2FKX 6w8MxkwkqEUjDXu+TF+zet+Dmk8SfRI2c70GNZKUFIRdtGo8MZXrk+3prJG3FSnE sYixVNZClDTvJ98mpxC9A6hHOb+SlQmFdeV3EwH3patOsebwoSw4/X3dtE7wAtQ= =0aQ/ -----END PGP SIGNATURE----- --RnlQjJ0d97Da+TV1--