Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753505AbcDOROy (ORCPT ); Fri, 15 Apr 2016 13:14:54 -0400 Received: from mail-bl2on0146.outbound.protection.outlook.com ([65.55.169.146]:22555 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753006AbcDOROq (ORCPT ); Fri, 15 Apr 2016 13:14:46 -0400 X-Greylist: delayed 169416 seconds by postgrey-1.27 at vger.kernel.org; Fri, 15 Apr 2016 13:14:45 EDT Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=hpe.com; Message-ID: <5711217A.6050003@hpe.com> Date: Fri, 15 Apr 2016 13:14:34 -0400 From: Waiman Long User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130109 Thunderbird/10.0.12 MIME-Version: 1.0 To: Boqun Feng CC: Alexander Viro , Jan Kara , Jeff Layton , "J. Bruce Fields" , Tejun Heo , Christoph Lameter , , , 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 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> <20160414233334.GA21026@fixme-laptop.cn.ibm.com> In-Reply-To: <20160414233334.GA21026@fixme-laptop.cn.ibm.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [72.71.243.152] X-ClientProxiedBy: SN1PR10CA0050.namprd10.prod.outlook.com (10.164.10.146) To TU4PR84MB0318.NAMPRD84.PROD.OUTLOOK.COM (10.162.186.28) X-MS-Office365-Filtering-Correlation-Id: bbcd157b-0a89-4a52-d145-08d365516e91 X-Microsoft-Exchange-Diagnostics: 1;TU4PR84MB0318;2:8fh7yzEgXleLUlSZJU8eifakOoARsXAfrKlfrmPuN+gM6yg4ZtHTNf77UXsQnoGJ38S/Wvd7lGK7JcPYz4AI5RqVFgevPSQsfax8csXy+mgcxRB98J087/bjIlFUruTotKcaVudqe50yJV7fyjwuALyaKzb6akO4hsaCCifXxq/2lD1CIFa9s56pMJfnVzZ9;3:xI3MjRkYtQ+zh1RJO57XD4aIuVsdiGl3xOh/RaOOTamsWZJlvv8Oop7ymkOGJThnDt++Fa1plS5afP807Ew4c9R60jsGHtmIlZWc1lRiANZ6Xtq9b1N7e8yWD+/1JLfF;25:1IdMXU3Bn3PT8DndD15fYrWBcvUsGXdDbWM9VPxc5kIXQj+zIq8PLhNcJ3oj0saFztXSkJQ5yPJTERnmPB3Dylc4yKV6itNsVQHKyBIPe6DO4c9J4KsP60JPqh/RUzUjsAOGYjs8F7WeOagyB2WdyjDHekRCY7acSihNFuJRV0fNSsCwkiWGqsvwXXsHOHOiF1jxRp+Rx0m4+STBb9mguMzbO8g45SJq4l0QkYQByb3c2eKeWQ/O8I+0a8u7G1nitUsMiR7cn/LiebL+3sJOYpEQmYtTmViQtS1BzDS7/v7voBewS+4wgIO8fCwxJ62OL83NuODMMdNKkgX7FQOn/Q== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:TU4PR84MB0318; X-LD-Processed: 105b2061-b669-4b31-92ac-24d304d195dc,ExtAddr X-Microsoft-Exchange-Diagnostics: 1;TU4PR84MB0318;20:71y/Sd+4Q8xo486Na7oMMif7UH4o1FqNxeqjiSWlkS4v8z10HE+pStv75cfD3BfhfpH9+Bh4qgW5xC4hy1xnB0VhPwRko8XtgmD83zseGQd4O/5/Fc9IB6+hLXgs7M4WHxBbJ/T3ZGSwMWLQ1MBi57ZohM7vqhn4enZQ0vJ3zATer6AdayxkAAV3r4P96PUOiqt/BXOUaYWUt2+L1UHgGdzmB6JQl8z1qj88U5IUC2BmChxJG76clBP2/m9ixDvrrjZr+Mq3E6ezGuRZjK2edZUC3kEwEbFIaY18BcKmArGAKCzZJBTBQMyTKACQbR81Xb3Ob1cApNQbGCubdiYrEg==;4:SyqU6nIOMuckMn0SfxVyCdcOtYGPTzxej//gA0bggq/6RJ4Op8S2jls/0jiOGDsCm/JtWuuv+7jAWzBe9Nre5cAhj9bPD8+XJMokL77lLp9RcOXlQM3zLRh+7XjQVHkSIsM3W13NcXMZLiPZr/OWhBCwzmE0Omw2/tj0CJ1icLcTvzTjc/XjUrAvSfYvxQeVPSAMLBiEjSbSb12xkj/uUMlv8Qv+P9PpiJ9CrjY8IdC9zT3YlfJQ8ZHXTyPrtVlrv1LW0zxFoTmiVXwuTKNrQmFlWktF/ZFAxAv89WRwtqdXSUp95XHfVjHK/l10l34mczwoozQlTXpcSWN7aszj620ZOjOg/uILcmqnE0bk6xFYqcNWICqMH1TuV+3gq0p3uptKb+DJOpXrDsIrAeYTDA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521026)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046);SRVR:TU4PR84MB0318;BCL:0;PCL:0;RULEID:;SRVR:TU4PR84MB0318; X-Forefront-PRVS: 0913EA1D60 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(377454003)(24454002)(52044002)(81166005)(59896002)(117156001)(33656002)(2906002)(92566002)(77096005)(65956001)(65806001)(47776003)(50466002)(2950100001)(66066001)(64126003)(189998001)(23756003)(1096002)(5008740100001)(6116002)(3846002)(586003)(99136001)(50986999)(76176999)(87266999)(54356999)(230700001)(80316001)(110136002)(4001350100001)(36756003)(86362001)(93886004)(5004730100002)(83506001)(42186005)(4326007);DIR:OUT;SFP:1102;SCL:1;SRVR:TU4PR84MB0318;H:[192.168.142.158];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?iso-8859-1?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vtb6KdVvV/sOSSy?= =?iso-8859-1?Q?Fx1KeucWDUEDnqMz4AspQY0LxWoh0tN9TM55GtfWW6zcsI9DfSddCx8Eg0?= =?iso-8859-1?Q?jXaWFewB9jaEoWg9mhZM2qpbr51scGOB7XGKXo1VAudYsWyujzMRaxyfuG?= =?iso-8859-1?Q?ndhsLnZaZdhfgelCfPHv2pQmY9ARFZmZOfrE2+qVF3ewwTfZ91QMI17kMX?= =?iso-8859-1?Q?k8ylNS+u8b6Ff/LOhmnuU7Edc0I5TiDxPjlPWSLY4IWIafOB18dFVHPZJj?= =?iso-8859-1?Q?Ct1XkwgKke6lYGME9sKa9OWJ7Gw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;TU4PR84MB0318;5:qQS3mlpgUiRWmsUeXOqT7Ttk+LbNIfEEauQfO83iHF1Llkth9Zmpmh0iZepyf+lwHE/9edDSsNWUJIU3suUPiTiLTjnfU6e7/orAx6X7l61vKDYz2+RVpnUWLcR4xvF6WuVsa98osXP9SnEjAAAEag==;24:tCZCMB4BSr5wQsDAJKLhd7lI3ig6CkGmBBQuBSRrAaZ8aOjlMVqXAtVw41THYsQ6UrvqySegwQIxKCtn72otJL29R0JQT/5bccZuhJgXkFE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2016 17:14:39.6333 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: TU4PR84MB0318 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1833 Lines: 58 On 04/14/2016 07:33 PM, Boqun Feng wrote: > 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, >>> >>> 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. >> > 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 > > That is not a problem. I do want to acknowledge your contribution to this patchset. Cheers, Longman