From: Daniel Wagner <daniel.wagner@bmw-carit.de>
To: Jeff Layton <jlayton@poochiereds.net>
Cc: Andi Kleen <andi@firstfloor.org>, <linux-fsdevel@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, John Kacur <jkacur@redhat.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
"J. Bruce Fields" <bfields@fieldses.org>
Subject: Re: [RFC v1 0/5] fs/locks: Use plain percpu spinlocks instead of lglock to protect file_lock
Date: Fri, 27 Feb 2015 16:01:30 +0100 [thread overview]
Message-ID: <54F086CA.5060606@bmw-carit.de> (raw)
In-Reply-To: <20150224160643.1d3366d5@tlielax.poochiereds.net>
Sorry for the late response. Got dragged away.
On 02/24/2015 10:06 PM, Jeff Layton wrote:
> On Tue, 24 Feb 2015 16:58:26 +0100
> Daniel Wagner <daniel.wagner@bmw-carit.de> wrote:
>
>> On 02/20/2015 05:05 PM, Andi Kleen wrote:
>>> Daniel Wagner <daniel.wagner@bmw-carit.de> 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.
Yes, that was I was referring to as benefit. My main point is that there
are only lg_local_* calls we could as well use normal spinlocks. No need
to fancy.
> 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?
Maybe I am overlooking something here but I don't see a consistency
problem. We list a blocker and all its waiter in a go since only the
blocker is added to flock_lock_list and the waiters are added blocker's
fl_block list.
> 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 agree, but I hope that I got it right with my consistency argument
than there shouldn't be a problem.
> I do however like the idea of moving more to be protected by the
> lglocks, and minimizing usage of the blocked_lock_lock.
Good to hear. I am trying to write a new test (a variation of the
dinning philosophers 'problem') case which benchmarks blocked_lock_lock
after the re-factoring.
cheers,
daniel
next prev parent reply other threads:[~2015-02-27 15:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-20 14:39 [RFC v1 0/5] fs/locks: Use plain percpu spinlocks instead of lglock to protect file_lock Daniel Wagner
2015-02-20 14:39 ` [RFC v1 1/5] locks: Remove unnecessary IS_POSIX test Daniel Wagner
2015-02-20 14:39 ` [RFC v1 2/5] locks: Split insert/delete block functions into flock/posix parts Daniel Wagner
2015-02-20 14:39 ` [RFC v1 3/5] seq_file: Add percpu seq_hlist helpers with locking iterators Daniel Wagner
2015-02-20 14:39 ` [RFC v1 4/5] locks: Use percpu spinlocks to protect file_lock_list Daniel Wagner
2015-02-20 14:39 ` [RFC v1 5/5] locks: Use blocked_lock_lock only to protect blocked_hash Daniel Wagner
2015-02-20 16:05 ` [RFC v1 0/5] fs/locks: Use plain percpu spinlocks instead of lglock to protect file_lock Andi Kleen
2015-02-24 15:58 ` Daniel Wagner
2015-02-24 21:06 ` Jeff Layton
2015-02-27 15:01 ` Daniel Wagner [this message]
2015-02-27 15:30 ` Jeff Layton
2015-03-02 12:58 ` Daniel Wagner
2015-03-03 0:29 ` Jeff Layton
2015-03-04 14:03 ` Daniel Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54F086CA.5060606@bmw-carit.de \
--to=daniel.wagner@bmw-carit.de \
--cc=andi@firstfloor.org \
--cc=bfields@fieldses.org \
--cc=jkacur@redhat.com \
--cc=jlayton@poochiereds.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.