Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1379208

Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks

From Waiman Long <waiman.long@hpe.com>
Newsgroups linux.kernel
Subject Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks
Date 2016-04-14 20:50 +0200
Message-ID <rnUuZ-6rs-3@gated-at.bofh.it> (permalink)
References <rnfrQ-72b-15@gated-at.bofh.it> <rnfBw-7qw-15@gated-at.bofh.it> <rnQhJ-2UH-47@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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<Waiman.Long@hpe.com>
> The patch looks good to me now. So you can add:
>
> Reviewed-by: Jan Kara<jack@suse.cz>
>
> 								Honza

Thanks for the review.

Cheers,
Longman

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v7 0/4] vfs: Use per-cpu list for SB's s_inodes list Waiman Long <Waiman.Long@hpe.com> - 2016-04-13 01:00 +0200
  [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks Waiman Long <Waiman.Long@hpe.com> - 2016-04-13 01:10 +0200
    Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated  per-cpu locks Boqun Feng <boqun.feng@gmail.com> - 2016-04-13 04:20 +0200
      Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated  per-cpu locks Waiman Long <waiman.long@hpe.com> - 2016-04-13 20:00 +0200
        Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated  per-cpu locks Boqun Feng <boqun.feng@gmail.com> - 2016-04-15 01:40 +0200
    Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated  per-cpu locks Christoph Lameter <cl@linux.com> - 2016-04-13 17:10 +0200
      Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated  per-cpu locks Waiman Long <waiman.long@hpe.com> - 2016-04-13 19:50 +0200
        Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated  per-cpu locks Christoph Lameter <cl@linux.com> - 2016-04-13 20:10 +0200
    Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated  per-cpu locks Jan Kara <jack@suse.cz> - 2016-04-14 16:20 +0200
      Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated  per-cpu locks Waiman Long <waiman.long@hpe.com> - 2016-04-14 20:50 +0200

csiph-web