Re: [PATCH v8 1/6] lib/dlock-list: Distributed and lock-protected lists

2017-11-29 Thread Davidlohr Bueso
On Tue, 31 Oct 2017, 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 list APIs that provide a set of distributed lis

Re: [PATCH v8 1/6] lib/dlock-list: Distributed and lock-protected lists

2017-11-03 Thread Davidlohr Bueso
On Thu, 02 Nov 2017, Waiman Long wrote: Instead of the current O(N) implementation; at the cost of adding an atomic counter. We also need to add a heads pointer to the node structure such that we can unaccount a thread doing list_del(). The counter will then become the single contention point

Re: [PATCH v8 1/6] lib/dlock-list: Distributed and lock-protected lists

2017-11-02 Thread Waiman Long
On 11/02/2017 01:04 PM, Davidlohr Bueso wrote: > On Tue, 31 Oct 2017, Waiman Long wrote: > >> +/** >> + * dlock_lists_empty - Check if all the dlock lists are empty >> + * @dlist: Pointer to the dlock_list_heads structure >> + * Return: true if list is empty, false otherwise. >> + * + * T

Re: [PATCH v8 1/6] lib/dlock-list: Distributed and lock-protected lists

2017-11-02 Thread Davidlohr Bueso
On Tue, 31 Oct 2017, Waiman Long wrote: +/** + * dlock_lists_empty - Check if all the dlock lists are empty + * @dlist: Pointer to the dlock_list_heads structure + * Return: true if list is empty, false otherwise. + * + * This can be a pretty expensive function call. If this function

Re: [PATCH v8 1/6] lib/dlock-list: Distributed and lock-protected lists

2017-11-01 Thread Waiman Long
On 10/31/2017 05:37 PM, Davidlohr Bueso wrote: > On Tue, 31 Oct 2017, Waiman Long wrote: > >> +void dlock_lists_del(struct dlock_list_node *node) >> +{ >> +struct dlock_list_head *head; >> +bool retry; >> + >> +do { >> +head = READ_ONCE(node->head); > > Boqun had previously poin

Re: [PATCH v8 1/6] lib/dlock-list: Distributed and lock-protected lists

2017-10-31 Thread Davidlohr Bueso
On Tue, 31 Oct 2017, Waiman Long wrote: +void dlock_lists_del(struct dlock_list_node *node) +{ + struct dlock_list_head *head; + bool retry; + + do { + head = READ_ONCE(node->head); Boqun had previously pointed this out; you need to WRITE_ONCE() node->head too.

[PATCH v8 1/6] lib/dlock-list: Distributed and lock-protected lists

2017-10-31 Thread Waiman Long
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 list APIs that provide a set of distributed lists (one per CPU), each of which is protecte