Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754586AbcDMRxk (ORCPT ); Wed, 13 Apr 2016 13:53:40 -0400 Received: from mail-by2on0123.outbound.protection.outlook.com ([207.46.100.123]:45235 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750916AbcDMRxg (ORCPT ); Wed, 13 Apr 2016 13:53:36 -0400 Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=hpe.com; Message-ID: <570E8419.7090909@hpe.com> Date: Wed, 13 Apr 2016 13:38:33 -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> In-Reply-To: <20160413020929.GA23058@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.105] X-ClientProxiedBy: CY1PR12CA0072.namprd12.prod.outlook.com (10.163.230.40) To CS1PR84MB0310.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.28) X-MS-Office365-Filtering-Correlation-Id: b3ac0f28-3d96-4f9c-e046-08d363c2749d X-Microsoft-Exchange-Diagnostics: 1;CS1PR84MB0310;2:lpYuXEGLK+Pa/bg9cfLvF4Dx79TY4MNSVStpxLxUPY5u0t0PnICF3KhDElaCUcFpxsha5z19LdRR/YBG50K7e5IOrKGBr219kf6G/c6rzoMSC+UtHGvndW0ypa4CHXJEFUDDwkKLV3CRhPgVQfR+8QjjRXRwKxIN7pxtFToYhkQESPzJhfgDZype6Ur/s+7A;3:NcCotnp1Z49MuoY0bwAbZNrlIvLD8Vvwv+LrVxvf8D/xmFPQFVUS2GRZ/khMn/wBBm8r0jrSIBIc55xDDGZ16ujxWLi/gjoNkxb/jACOHrvDVNKRPO3idXSqOJQgzOc7 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0310; X-Microsoft-Exchange-Diagnostics: 1;CS1PR84MB0310;25:ecPy3q1L2tNNA8iHnE9bSKFbFtgD8eZYAs7M3xkEiTq7ucxi+KQbAcYVsIgyeb9KLM6mTNQkOO7OsJr2yvQQZlTNz/Owby/k2a24sGbcyXAJcrYjdJ76ZfkVjoLVgcKkipuhwz+yM72MZbr2bh41iwvjm5azKvKmNt/FAHRM7w0CBXP+1gRRjaMRs5wkiV6E2k8ASPoRGiXpwm6vLTE4wKqAJfaRVdpANIk6HsjwZJC/qCBbdQ1tW/emJm35v1oSFOnOcS1e4mCU4SMweJ5R4H/D6UfhASzzarxOo1f77PJtwYkKlnqLyQt3/GJPGzcwLcfHHEEXAdWlRcy26R5Oplca/bZNfpS0w5+6fcXXZFq6ko0yYOxSHLBAS83hxa66NR0dCqGGlDypVinFxUVpqR94KClJr3riT0thZM7+Py0O+cVTi5IhBch8fxPPZopl4T8aS664wPQp5+oY5UfMwrKAY54XADcD7emuiOTlY0ot/t6XnU84u+SNQcDRw9Nz/8WhCXqyHg/B6NDY6e0Dn/CS77qvgpa8tLkJ78p8C0FtkbApe4o4vGAgVpdzm7j0qSgKLqhMKvLaZKybsgYvXp1gnTmbRNv6sNsp0zREuf9y9j1jaK0F4Pc4NPo3h1S893H/YYjy8jTKC4AQeidvtg== X-LD-Processed: 105b2061-b669-4b31-92ac-24d304d195dc,ExtAddr X-Microsoft-Exchange-Diagnostics: 1;CS1PR84MB0310;20:uQqM/jUDdlONYmtQdyNRgbal7EOE/9ihJR2go2hcV/pZp0tk03bmlYsTrl4eKi/Ottzjc/UdZrrq/36JMotxwwvu5mISZtTlPQQfuPmh4QUlOkTddiDGKHeAdfj+ZOtvaY6DvEA9NiTGBUvxmBeuCA1RK6G5DOh0kvKHClmbJNlgRB0bmSjQAO/TXnMXUYtZggWIv285aMMJbXeOpqn+xr+aaq1j98jmvKWQZ4Y1dtJwpholPsBnizSeulG4dbSqxtecIrQ369zxHiPjyxS8Y7ooxavcqJ8vNn1C7gAtDx9R/HzSI/lMZ56jVIXZcHM7leVK+NXmwv+XdaAizE1gjQ==;4:meGLEK+vxLStHquROzui4Ld0nQTtOnzy70Kh9NHbjpoTmBM4AyWg4d67wiIZrxi4U79dy/JsMORQr8bnFLg2wa/MJQU6XAkSkBN1jC2tdqD8v1+3BiHET2Qlm0H8f2F8gh2A6Rj934HOmygPWECHVPkex6/4sRppS3JbggM0anWmbWo+8KgN7U3URpMAerzL+epbTSwVyV6vQdFAUOUBzQdMXsOzLloZ5Dv5HRERZeC1sG2u5AbghRBnu8JiN2rSq+soL8ap4pUvxsAZiR+vPje/EaNuTV6Ld4z2x6vU+a0RbzldIuy9EzUumWD3bv3NwZkGbZwT0dsSfQPPzGLZyJuzL5MUGfBDJ7aW8730LSNQ4bSTNyYTFIthxjq3wc0w X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001);SRVR:CS1PR84MB0310;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0310; X-Forefront-PRVS: 0911D5CE78 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6049001)(377454003)(24454002)(86362001)(80316001)(5004730100002)(4001350100001)(92566002)(65816999)(110136002)(189998001)(76176999)(87266999)(54356999)(50986999)(83506001)(4326007)(47776003)(36756003)(65806001)(50466002)(1096002)(2950100001)(230700001)(66066001)(64126003)(2906002)(23756003)(81166005)(42186005)(164054004)(5008740100001)(586003)(6116002)(117156001)(3846002)(77096005)(33656002);DIR:OUT;SFP:1102;SCL:1;SRVR:CS1PR84MB0310;H:[192.168.142.156];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?iso-8859-1?Q?1;CS1PR84MB0310;23:a0rgy3es3LJZdv1gfAWoeSLpWFelcWdpYIvmvmK?= =?iso-8859-1?Q?o6Qa38P0/f67qcRsAyb89zQ8RUE9smhIpmVB5vTuIXByUslPkdTYUkCuJZ?= =?iso-8859-1?Q?dSpu3nv0ILnBhIy8vHM5U9r+uqxdSSsXume1V+RpaRS9WOv06V+znrKn/K?= =?iso-8859-1?Q?/4snZtUwWPG3EeCM9dvnvKuXQGIoscC/U1nF0ff5Dj2l9j6lVZbX6LB7Al?= =?iso-8859-1?Q?tOjPPLeHtHNqY98Lue4Fu2WP0aDL9/bVmPz0jlUn1CvlxRF2enq6e5Z/It?= =?iso-8859-1?Q?1J42Yq1RYm0gWVOOLEhkUni+eMCte9daBYLz1+jj2NRNi+j/uh9FxSbaUw?= =?iso-8859-1?Q?VgmfhLJ8v0hDR5Kxr/utazUJRIhvJsUg2JAh02ZbyU57i20PRRWCRD62Wi?= =?iso-8859-1?Q?b6CoaF9wOL3sl6qtoxfPqRGXOnsv9xbobqXLdotsS+sFtL8Tg4zb5LWAC3?= =?iso-8859-1?Q?c57xfkGSIj6MrUONBNvEWc0YfrAFy4NrpGBQp0b3VJa4WVOXL6Ht2j4BVO?= =?iso-8859-1?Q?0IQqCl03WN0C2XZ0x5Ekhee1Aax4K+LM3KBoZ0EbIHKbxq/RYA001ffgUA?= =?iso-8859-1?Q?zi1YBEhu2IVCRojFBWQb8NDHsJ5gRNfBoK9upAdXjkdXxUJn10Dhn+ZA7F?= =?iso-8859-1?Q?AKNCqdOalI0fYhSkMw3BCKhHH1+UtaYHQcCCToryFbcMHVu7jVB5GqFu0C?= =?iso-8859-1?Q?hRta2AHnOkZ45qSj6urgo/B8vCbN8jPjBfbmY4bvXMXkI4VkgIrNKQ41o8?= =?iso-8859-1?Q?29p70RJyTZlyYSZxqv2TLwJjV+z3THdses9TkhOEM2YZH7kF7VN8TOfilP?= =?iso-8859-1?Q?zW7kL0wdIeJ3+LSx4dhaNUieYzBHDP390T+PUJjYE2WF/OnJQQW9+ICRfg?= =?iso-8859-1?Q?0ug503i5cBBNk5lbR+amfZT4Jr3hprwLEsmlZts2+XaKMvkKDp3BfDXQXS?= =?iso-8859-1?Q?5sx2ByFnNzAaQBYcmbJmgl1X+d+oJ5lsg8Ai+yktMD87zGRHZfLgNyRxcY?= =?iso-8859-1?Q?5ejOfPDvW/RqqlfFYW5iy+sTgilqztBxuAh0/MhGeLcCNBhdJ6XtaLQ/ba?= =?iso-8859-1?Q?6A78f2Ov9Efk5JuEyBLhDdkJFnri7fCKkDrro+mVzw=3D?= X-Microsoft-Exchange-Diagnostics: 1;CS1PR84MB0310;5:YIzt2FaeJANNIpLZpleGcrW315eIMHoTWESWNcXaIWGn38p6Wh7thMNUwqlQMGO0r90RDsztWMFyqRduc1RIshJz3/rrULgj2MCAy+uiTfYY5N0sAjnZxVqpDLhR2g6MvUeM+gS4eOJABRNl9kIzRQ==;24:/Fgk1X8Zh50Qx9pelO6qCvd2DYqx0ZNqUDB1NSwOM20uDPE7aQNsxyR8MW3YXcL8NDzxNfE2EI07P+zQ5yeapHQ5dy6wgF9fgttt7Sy7ios= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2016 17:38:40.6773 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0310 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1322 Lines: 45 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