Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp138499imm; Tue, 16 Oct 2018 19:52:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV61/ODfau3xlY2ZM50lJ4IzC7kqWXmi6RjFAlExyrka5Httf3BcWZKGL9uV6di05YX+syrKx X-Received: by 2002:a17:902:368:: with SMTP id 95-v6mr24333459pld.319.1539744779476; Tue, 16 Oct 2018 19:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539744779; cv=none; d=google.com; s=arc-20160816; b=DN/knBnCRh9jaHkGBwqjTpY9cM+tdt8L56J5qDsVr5MNRGosOuwKkNFkanrPYxbCvU Co+The7AUuRgxwhWUTz2+mOOw4sxfmDkH2SzHbQJ/rqBEgMBv7ctoERZ+9jDmalVLInW 3DoSsjVz/jCq+8LYPtM4oibEUEbHx+l/kHNj+H84NWdVub8L4GXYNCvKWJ1dVwDgjEH0 K56E9/vpO3Rotn5ff+1vCtnOSGrR4SDZXg9U30QpoF2y/E/LIkmcXqVW7bNqlL32suAY /RH/TVhJnp2yURYhlc3jiVkywaoo5iGVABUrwvJm6OohF8A4aZ9sqSoBRzsk3XdSQjBS 21dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=QIe8u1aqfBrhKAjOZuV1Eb9SflNQW2L51WgG1pC5J64=; b=0Rboot2LVaT3xId1dj80XNKePGdBDrEZGs6pj2OHjbSy+lqK1TDc7Nf90po/M67lFG hEoLy8HrcuXzqmDS5D9ulJBIqR1y3UI9j8VtV8KDnHvfCPgeeO/Xu9Jl2JhkkzWnnWRy UjxGEuy5uVjLtK6Ov4/NfGFUbNThkdAh4ybOdxz7pM9+hlJ4JvbJUJ2im4BUvlGXgPMq aaxVojzyO1zw3nYeIgmvNceeJK6YGprsH8Xc20wZyjkUn5ZFuB3/WHj9Q44XpxqZvQfK izRJjo2pqMOVcyAREfndGDLZPhfeLIH+7tF3FJyH1PNlcLFRil0La46fsr4YWdKJ9HA9 Hj6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9-v6si16921385plf.345.2018.10.16.19.52.43; Tue, 16 Oct 2018 19:52:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727397AbeJQKp0 (ORCPT + 99 others); Wed, 17 Oct 2018 06:45:26 -0400 Received: from mx2.suse.de ([195.135.220.15]:48464 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727087AbeJQKp0 (ORCPT ); Wed, 17 Oct 2018 06:45:26 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6C44EAC11; Wed, 17 Oct 2018 02:51:57 +0000 (UTC) Date: Tue, 16 Oct 2018 19:51:47 -0700 From: Davidlohr Bueso To: Waiman Long Cc: Jan Kara , 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 Subject: Re: [PATCH v9 5/5] lib/dlock-list: Scale dlock_lists_empty() Message-ID: <20181017025147.wfk7cktcn3emlb6b@linux-r8p5> References: <1536780532-4092-1-git-send-email-longman@redhat.com> <1536780532-4092-6-git-send-email-longman@redhat.com> <20181004071600.GC29482@quack2.suse.cz> <5bcdf2a2-6d03-df21-934d-6c989549253b@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <5bcdf2a2-6d03-df21-934d-6c989549253b@redhat.com> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 04 Oct 2018, Waiman Long wrote: >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. So fyi I ended up porting the epoll ready-list to this api, where dlock_lists_empty() performance _does_ matter. However, the list iteration is common enough operation to put perform the benefits of the percpu add/delete operations. For example, when sending ready events to userspace (ep_send_events_proc()), each item must drop the iter lock, and also do a delete operation -- similarly for checking for ready events (ep_read_events_proc). This ends hurting more than benefiting workloads. Anyway, so yeah I have no need for this patch, and the added complexity + atomics is unjustified. Thanks, Davidlohr