Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1159781
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Oleg Nesterov <oleg@redhat.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [RFC][PATCH 0/5] Optimize percpu-rwsem |
| Date | Sat, 06 Jun 2015 01:40:02 +0200 |
| Message-ID | <py9ns-7p5-3@gated-at.bofh.it> (permalink) |
| References | <pum9z-3Vw-3@gated-at.bofh.it> <purCh-3CE-5@gated-at.bofh.it> <pus5k-4br-11@gated-at.bofh.it> <puv3b-8uo-3@gated-at.bofh.it> <pxOVI-27S-7@gated-at.bofh.it> <py7bY-3VJ-17@gated-at.bofh.it> <py882-5Eq-7@gated-at.bofh.it> |
| X-Original-To | Al Viro <viro@ZenIV.linux.org.uk> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.18 (2008-05-17) |
| X-Scanned-By | MIMEDefang 2.68 on 10.5.11.22 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 61 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Linus Torvalds <torvalds@linux-foundation.org>, Davidlohr Bueso <dave@stgolabs.net>, Peter Zijlstra <peterz@infradead.org>, Paul McKenney <paulmck@linux.vnet.ibm.com>, Tejun Heo <tj@kernel.org>, Ingo Molnar <mingo@redhat.com>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, der.herr@hofr.at |
| X-Original-Date | Sat, 6 Jun 2015 01:36:22 +0200 |
| X-Original-Message-ID | <20150605233622.GA31034@redhat.com> |
| X-Original-References | <20150526114356.609107918@infradead.org> <CA+55aFwxjAWTm9XZg0ZE6kB70S8iKV6b8RQL8Bi6fapaPbwpRQ@mail.gmail.com> <1432665731.8196.3.camel@stgolabs.net> <CA+55aFxPyBfsfspXucTdo3PhBsxT4_5kPJN6Ace=-=DcgWODWw@mail.gmail.com> <20150605014558.GS7232@ZenIV.linux.org.uk> <20150605210857.GA24905@redhat.com> <20150605221111.GY7232@ZenIV.linux.org.uk> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | aioe.org linux.kernel:1159781 |
Show key headers only | View raw
On 06/05, Al Viro wrote:
>
> On Fri, Jun 05, 2015 at 11:08:57PM +0200, Oleg Nesterov wrote:
> > On 06/05, Al Viro wrote:
> > >
> > > FWIW, I hadn't really looked into stop_machine uses, but fs/locks.c one
> > > is really not all that great - there we have a large trashcan of a list
> > > (every file_lock on the system) and the only use of that list is /proc/locks
> > > output generation. Sure, additions take this CPU's spinlock. And removals
> > > take pretty much a random one - losing the timeslice and regaining it on
> > > a different CPU is quite likely with the uses there.
> > >
> > > Why do we need a global lock there, anyway? Why not hold only one for
> > > the chain currently being traversed? Sure, we'll need to get and drop
> > > them in ->next() that way; so what?
> >
> > And note that fs/seq_file.c:seq_hlist_next_percpu() has no other users.
> >
> > And given that locks_delete_global_locks() takes the random lock anyway,
> > perhaps the hashed lists/locking makes no sense, I dunno.
>
> It's not about making life easier for /proc/locks; it's about not screwing
> those who add/remove file_lock...
I meant, seq_hlist_next_percpu() could be "static" in fs/locks.c.
> And no, that "random lock" isn't held
> when modifying the (per-cpu) lists - it protects the list hanging off each
> element of the global list, and /proc/locks scans those lists, so rather
> than taking/dropping it in each ->show(), it's taken once in ->start()...
Sure, I understand. I meant that (perhaps) something like
struct {
spinlock_t lock;
struct list_head *head
} file_lock_list[];
locks_insert_global_locks(fl)
{
int idx = fl->idx = hash(fl);
spin_lock(&file_lock_list[idx].lock);
hlist_add_head(...);
spin_unlock(...);
}
seq_hlist_next_percpu() could scan file_lock_list[] and unlock/lock ->lock
when it changes the index.
But please forget, this is really minor. Just I think that file_lock_list
is not actually "per-cpu", exactly because every locks_delete_global_locks()
needs lg_local_lock_cpu(fl->fl_link_cpu) as you pointed out.
Oleg.
--
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/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [RFC][PATCH 0/5] Optimize percpu-rwsem Oleg Nesterov <oleg@redhat.com> - 2015-06-06 01:40 +0200
csiph-web