Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753240AbbBXVGx (ORCPT ); Tue, 24 Feb 2015 16:06:53 -0500 Received: from mail-yk0-f173.google.com ([209.85.160.173]:46006 "EHLO mail-yk0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751444AbbBXVGv (ORCPT ); Tue, 24 Feb 2015 16:06:51 -0500 Date: Tue, 24 Feb 2015 16:06:43 -0500 From: Jeff Layton To: Daniel Wagner Cc: Andi Kleen , , , John Kacur , Alexander Viro , "J. Bruce Fields" Subject: Re: [RFC v1 0/5] fs/locks: Use plain percpu spinlocks instead of lglock to protect file_lock Message-ID: <20150224160643.1d3366d5@tlielax.poochiereds.net> In-Reply-To: <54EC9FA2.1030000@bmw-carit.de> References: <1424443195-18676-1-git-send-email-daniel.wagner@bmw-carit.de> <87vbiwwotb.fsf@tassilo.jf.intel.com> <54EC9FA2.1030000@bmw-carit.de> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2055 Lines: 48 On Tue, 24 Feb 2015 16:58:26 +0100 Daniel Wagner wrote: > On 02/20/2015 05:05 PM, Andi Kleen wrote: > > Daniel Wagner writes: > >> > >> I am looking at how to get rid of lglock. Reason being -rt is not too > >> happy with that lock, especially that it uses arch_spinlock_t and > > > > AFAIK it could just use normal spinlock. Have you tried that? > > I have tried it. At least fs/locks.c didn't blow up. The benchmark > results (lockperf) indicated that using normal spinlocks is even > slightly faster. Simply converting felt like cheating. It might be > necessary for the other user (kernel/stop_machine.c). Currently it looks > like there is some additional benefit getting lglock away in fs/locks.c. > What would that benefit be? lglocks are basically percpu spinlocks. Fixing some underlying infrastructure that provides that seems like it might be a better approach than declaring them "manually" and avoiding them altogether. Note that you can still do basically what you're proposing here with lglocks as well. Avoid using lg_global_* and just lock each one in turn. That said, now that I've thought about this, I'm not sure that's really something we want to do when accessing /proc/locks. If you lock each one in turn, then you aren't freezing the state of the file_lock_list percpu lists. Won't that mean that you aren't necessarily getting a consistent view of the locks on those lists when you cat /proc/locks? I think having a consistent view there might trump any benefit to performance. Reading /proc/locks is a *very* rare activity in the big scheme of things. I do however like the idea of moving more to be protected by the lglocks, and minimizing usage of the blocked_lock_lock. -- Jeff Layton -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/