From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423794AbcBQPNb (ORCPT ); Wed, 17 Feb 2016 10:13:31 -0500 Received: from resqmta-ch2-09v.sys.comcast.net ([69.252.207.41]:49682 "EHLO resqmta-ch2-09v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423779AbcBQPN3 (ORCPT ); Wed, 17 Feb 2016 10:13:29 -0500 Date: Wed, 17 Feb 2016 09:13:25 -0600 (CST) From: Christoph Lameter X-X-Sender: cl@east.gentwo.org To: Waiman Long cc: Alexander Viro , Jan Kara , Jeff Layton , "J. Bruce Fields" , Tejun Heo , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Andi Kleen , Dave Chinner , Scott J Norton , Douglas Hatch Subject: Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated per-cpu locks In-Reply-To: <1455672680-7153-2-git-send-email-Waiman.Long@hpe.com> Message-ID: References: <1455672680-7153-1-git-send-email-Waiman.Long@hpe.com> <1455672680-7153-2-git-send-email-Waiman.Long@hpe.com> Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 16 Feb 2016, Waiman Long wrote: > 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. Is there a way to avoid locking completely? You could use cmpxchg_double to swap both list head and tail in an atomic fashion with some work. There is even a this_cpu_cmpxchg_double available.