Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932518AbcDNSsY (ORCPT ); Thu, 14 Apr 2016 14:48:24 -0400 Received: from mail-by2on0124.outbound.protection.outlook.com ([207.46.100.124]:47648 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752332AbcDNSsV (ORCPT ); Thu, 14 Apr 2016 14:48:21 -0400 Authentication-Results: suse.cz; dkim=none (message not signed) header.d=none;suse.cz; dmarc=none action=none header.from=hpe.com; Message-ID: <570FE5E7.5000004@hpe.com> Date: Thu, 14 Apr 2016 14:48:07 -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: Jan Kara CC: Alexander Viro , Jan Kara , Jeff Layton , "J. Bruce Fields" , Tejun Heo , Christoph Lameter , , , Ingo Molnar , Peter Zijlstra , Andi Kleen , Dave Chinner , Boqun Feng , 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> <20160414141031.GE22053@quack2.suse.cz> In-Reply-To: <20160414141031.GE22053@quack2.suse.cz> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [72.71.243.58] X-ClientProxiedBy: CO2PR06CA033.namprd06.prod.outlook.com (10.141.242.33) To TU4PR84MB0320.NAMPRD84.PROD.OUTLOOK.COM (10.162.186.30) X-MS-Office365-Filtering-Correlation-Id: 79803814-fa9e-4cf4-b210-08d3649558a7 X-Microsoft-Exchange-Diagnostics: 1;TU4PR84MB0320;2:Tm2HVoGX1pmFVTEPjRgswSIEsuwvC3pTcPzTmcNQni7EkgoJDb5wPft7/wTWzOwkCRHmZQdbD3muU8vMNhtJ9lgQJ1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MJ4TgMXHM3CvH5CWiNxAbrddJxc7oWeyWmyKCcfDJ1fdxcrdvvmuLadxSHl1P7wpm1LbaB6cwIiZO0iGzpCu6VR5IPIcP0vRSq484sO0/GVni8WV46xx5BtSp3dnnnddqcgSBarcylJsgPU5ufAPMSmjSyDFKQMesgqutlmARUG6DCZxgy4BigT/iebbP+XODYbOAU7LZ9LXZVvOi5k8oPqkdxt6ysW3Tb84wjhES5hZnptRWrCQqsY/n6b6aeLEaS59/7IAax7RjDVA0q3EAOHHUTJWTawRVrsr1T02l1j31WCYIEhm6n9l0Hv9lpiUcfnqM 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:TU4PR84MB0320;BCL:0;PCL:0;RULEID:;SRVR:TU4PR84MB0320; X-Forefront-PRVS: 0912297777 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(377424004)(377454003)(24454002)(51914003)(66066001)(65956001)(65806001)(47776003)(83506001)(64126003)(23756003)(586003)(50466002)(80316001)(230700001)(19580395003)(19580405001)(2906002)(65816999)(4326007)(3846002)(1096002)(6116002)(50986999)(87266999)(54356999)(76176999)(189998001)(59896002)(117156001)(81166005)(5004730100002)(33656002)(5008740100001)(2950100001)(36756003)(86362001)(77096005)(4001350100001)(92566002)(110136002)(42186005);DIR:OUT;SFP:1102;SCL:1;SRVR:TU4PR84MB0320;H:[192.168.142.157];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?iso-8859-1?Q?1;TU4PR84MB0320;23:8U4cjNQ8UDphEJMyUfttQkIFKuOa9LR7gmSbarS?= =?iso-8859-1?Q?F3XjAE7Y1JPEauboOTMgzPUY0e3Ud6xydRc4Dwjsh38+fSeYzHqq8nOf5U?= =?iso-8859-1?Q?+vJg7kSIxlYnnpGbAlDKWQiJf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?Q?j18j6vHOQtekYZJZh7pb1Y3AJkZbL0jTjhJZmp1fN0SJycxp2tVb/Y6gjn?= =?iso-8859-1?Q?u5vYFks/xiiLtauxjqMAAX5BMJIA7iu+bCerj+XOKseFYuU9PoyFDJtKJG?= =?iso-8859-1?Q?i8SeY17abIJsa7Bl8wFt+RBGpexnaG3EYgB5O1px5Bykh/EkCAMBeSO8f1?= =?iso-8859-1?Q?V/mTa1GgiCj7YXyPZQgPFs6OZV3ni0RdbzNxNlu2GNxRxpzRfoMRDE=3D?= X-Microsoft-Exchange-Diagnostics: 1;TU4PR84MB0320;5:2Un2cV1uzw3TuqvO83/Jbpxut04inXtIn3a4ck1Ydh9CmgqF1GZLEL0hktRVx4l+//To430J/6Hhd6ZxA82Brvue8e0UCloZY/uQsjIQGxKsNjYuRk7XLmI9CdKuVa8PF/Y7KekKJNpqj4vU+UVQTQ==;24:oGk4YkBDdOGUJ3u2aRfN68goOStTHXFZp3C9HucYXz6WY1eh38Ny5Qr9PRg9mhvSGCxrGSgv7MmLdKxmql6cebA6iGn2qh0+nSDhNmqsNZc= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2016 18:48:16.4191 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: TU4PR84MB0320 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1855 Lines: 43 On 04/14/2016 10:10 AM, Jan Kara wrote: > On Tue 12-04-16 18:54:43, Waiman Long wrote: >> Linked list is used everywhere in the Linux kernel. However, if many >> threads are trying to add or delete entries into the same linked list, >> it can create a performance bottleneck. >> >> This patch introduces a new per-cpu list subystem with associated >> per-cpu locks for protecting each of the lists individually. This >> allows list entries insertion and deletion operations to happen in >> parallel instead of being serialized with a global list and lock. >> >> List entry insertion is strictly per cpu. List deletion, however, can >> happen in a cpu other than the one that did the insertion. So we still >> need lock to protect the list. Because of that, there may still be >> a small amount of contention when deletion is being done. >> >> A new header file include/linux/percpu-list.h will be added with the >> associated pcpu_list_head and pcpu_list_node structures. The following >> functions are provided to manage the per-cpu list: >> >> 1. int init_pcpu_list_head(struct pcpu_list_head **ppcpu_head) >> 2. void pcpu_list_add(struct pcpu_list_node *node, >> struct pcpu_list_head *head) >> 3. void pcpu_list_del(struct pcpu_list *node) >> >> Iteration of all the list entries within a group of per-cpu >> lists is done by calling either the pcpu_list_iterate() or >> pcpu_list_iterate_safe() functions in a while loop. They correspond >> to the list_for_each_entry() and list_for_each_entry_safe() macros >> respectively. The iteration states are keep in a pcpu_list_state >> structure that is passed to the iteration functions. >> >> Signed-off-by: Waiman Long > The patch looks good to me now. So you can add: > > Reviewed-by: Jan Kara > > Honza Thanks for the review. Cheers, Longman