From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753911AbdJIH0S (ORCPT ); Mon, 9 Oct 2017 03:26:18 -0400 Received: from mx2.suse.de ([195.135.220.15]:42731 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750930AbdJIH0Q (ORCPT ); Mon, 9 Oct 2017 03:26:16 -0400 Date: Mon, 9 Oct 2017 09:26:13 +0200 From: Jan Kara 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 , Waiman Long Subject: Re: [PATCH v6 4/6] lib/dlock-list: Make sibling CPUs share the same linked list Message-ID: <20171009072613.GA17917@quack2.suse.cz> References: <1507152007-28753-1-git-send-email-longman@redhat.com> <1507152007-28753-5-git-send-email-longman@redhat.com> <20171005085947.GC28132@quack2.suse.cz> <9ded5c76-4379-0339-6482-1f8bb590e3f2@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9ded5c76-4379-0339-6482-1f8bb590e3f2@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 05-10-17 10:57:07, Waiman Long wrote: > On 10/05/2017 04:59 AM, Jan Kara wrote: > > On Wed 04-10-17 17:20:05, Waiman Long wrote: > >> int alloc_dlock_list_heads(struct dlock_list_heads *dlist) > >> { > >> - int idx; > >> + int idx, cnt = nr_dlock_lists ? nr_dlock_lists : nr_cpu_ids; > > Hum, is this there for the case where alloc_dlock_list_heads() is called > > before nr_dlock_lists is initialized? But how can the dlist be used later > > when it has larger number of lists and you don't know how many? > > The point is nr_dlock_lists <= nr_cpu_ids. Before nr_dlock_lists is > initialized, the mapping table will map all cpus to the first entry. So > the extra entries will just stay unused. At free time, they will all get > de-allocated. I will clarify that with a comment. OK, nice trick. Honza -- Jan Kara SUSE Labs, CR