From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:38784 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727264AbeJDUfU (ORCPT ); Thu, 4 Oct 2018 16:35:20 -0400 Subject: Re: [PATCH v9 5/5] lib/dlock-list: Scale dlock_lists_empty() To: Jan Kara 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 , Davidlohr Bueso , Davidlohr Bueso References: <1536780532-4092-1-git-send-email-longman@redhat.com> <1536780532-4092-6-git-send-email-longman@redhat.com> <20181004071600.GC29482@quack2.suse.cz> From: Waiman Long Message-ID: <5bcdf2a2-6d03-df21-934d-6c989549253b@redhat.com> Date: Thu, 4 Oct 2018 09:41:56 -0400 MIME-Version: 1.0 In-Reply-To: <20181004071600.GC29482@quack2.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 10/04/2018 03:16 AM, Jan Kara wrote: > On Wed 12-09-18 15:28:52, Waiman Long wrote: >> From: Davidlohr Bueso >> >> Instead of the current O(N) implementation, at the cost >> of adding an atomic counter, we can convert the call to >> an atomic_read(). The counter only serves for accounting >> empty to non-empty transitions, and vice versa; therefore >> only modified twice for each of the lists during the >> lifetime of the dlock (while used). >> >> In addition, to be able to unaccount a list_del(), we >> add a dlist pointer to each head, thus minimizing the >> overall memory footprint. >> >> Signed-off-by: Davidlohr Bueso >> Acked-by: Waiman Long > So I was wondering: Is this really worth it? AFAICS we have a single call > site for dlock_lists_empty() and that happens during umount where we don't > really care about this optimization. So it seems like unnecessary > complication to me at this point? If someone comes up with a usecase that > needs fast dlock_lists_empty(), then sure, we can do this... > Yes, that is true. We can skip this patch for the time being until a use case comes up which requires dlock_lists_empty() to be used in the fast path. Cheers, Longman