Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755715AbcDNOKl (ORCPT ); Thu, 14 Apr 2016 10:10:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:38553 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753706AbcDNOKk (ORCPT ); Thu, 14 Apr 2016 10:10:40 -0400 Date: Thu, 14 Apr 2016 16:10:31 +0200 From: Jan Kara 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 , Boqun Feng , Scott J Norton , Douglas Hatch Subject: Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks Message-ID: <20160414141031.GE22053@quack2.suse.cz> References: <1460501686-37096-1-git-send-email-Waiman.Long@hpe.com> <1460501686-37096-2-git-send-email-Waiman.Long@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1460501686-37096-2-git-send-email-Waiman.Long@hpe.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1782 Lines: 41 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 -- Jan Kara SUSE Labs, CR