Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1484985 > unrolled thread

Re: [PATCH 1/4] mm, vmscan: Batch removal of mappings under a single lock during reclaim

Started byPeter Zijlstra <peterz@infradead.org>
First post2016-09-16 15:30 +0200
Last post2016-09-17 03:40 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/4] mm, vmscan: Batch removal of mappings under a single  lock during reclaim Peter Zijlstra <peterz@infradead.org> - 2016-09-16 15:30 +0200
    Re: [PATCH 1/4] mm, vmscan: Batch removal of mappings under a single  lock during reclaim Peter Zijlstra <peterz@infradead.org> - 2016-09-16 16:10 +0200
    Re: [PATCH 1/4] mm, vmscan: Batch removal of mappings under a single  lock during reclaim Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-16 20:40 +0200
      Re: [PATCH 1/4] mm, vmscan: Batch removal of mappings under a single  lock during reclaim Peter Zijlstra <peterz@infradead.org> - 2016-09-17 03:40 +0200

#1484985 — Re: [PATCH 1/4] mm, vmscan: Batch removal of mappings under a single lock during reclaim

FromPeter Zijlstra <peterz@infradead.org>
Date2016-09-16 15:30 +0200
SubjectRe: [PATCH 1/4] mm, vmscan: Batch removal of mappings under a single lock during reclaim
Message-ID<si1nj-5f0-1@gated-at.bofh.it>
On Fri, Sep 09, 2016 at 10:59:32AM +0100, Mel Gorman wrote:
> Pages unmapped during reclaim acquire/release the mapping->tree_lock for
> every single page. There are two cases when it's likely that pages at the
> tail of the LRU share the same mapping -- large amounts of IO to/from a
> single file and swapping. This patch acquires the mapping->tree_lock for
> multiple page removals.

So, once upon a time, in a galaxy far away,..  I did a concurrent
pagecache patch set that replaced the tree_lock with a per page bit-
spinlock and fine grained locking in the radix tree.

I know the mm has changed quite a bit since, but would such an approach
still be feasible?

I cannot seem to find an online reference to a 'complete' version of
that patch set, but I did find the OLS paper on it and I did find some
copies on my local machines.

[toc] | [next] | [standalone]


#1485010

FromPeter Zijlstra <peterz@infradead.org>
Date2016-09-16 16:10 +0200
Message-ID<si202-5IX-17@gated-at.bofh.it>
In reply to#1484985
On Fri, Sep 16, 2016 at 03:25:06PM +0200, Peter Zijlstra wrote:
> On Fri, Sep 09, 2016 at 10:59:32AM +0100, Mel Gorman wrote:
> > Pages unmapped during reclaim acquire/release the mapping->tree_lock for
> > every single page. There are two cases when it's likely that pages at the
> > tail of the LRU share the same mapping -- large amounts of IO to/from a
> > single file and swapping. This patch acquires the mapping->tree_lock for
> > multiple page removals.
> 
> So, once upon a time, in a galaxy far away,..  I did a concurrent
> pagecache patch set that replaced the tree_lock with a per page bit-
> spinlock and fine grained locking in the radix tree.
> 
> I know the mm has changed quite a bit since, but would such an approach
> still be feasible?
> 
> I cannot seem to find an online reference to a 'complete' version of
> that patch set, but I did find the OLS paper on it and I did find some
> copies on my local machines.

https://www.kernel.org/doc/ols/2007/ols2007v2-pages-311-318.pdf

[toc] | [prev] | [next] | [standalone]


#1485233

FromLinus Torvalds <torvalds@linux-foundation.org>
Date2016-09-16 20:40 +0200
Message-ID<si6dk-8sO-13@gated-at.bofh.it>
In reply to#1484985
On Fri, Sep 16, 2016 at 6:25 AM, Peter Zijlstra <peterz@infradead.org> wrote:
>
> So, once upon a time, in a galaxy far away,..  I did a concurrent
> pagecache patch set that replaced the tree_lock with a per page bit-
> spinlock and fine grained locking in the radix tree.

I'd love to see the patch for that. I'd be a bit worried about extra
locking in the trivial cases (ie multi-level locking when we now take
just the single mapping lock), but if there is some smart reason why
that doesn't happen, then..

                Linus

[toc] | [prev] | [next] | [standalone]


#1485457

FromPeter Zijlstra <peterz@infradead.org>
Date2016-09-17 03:40 +0200
Message-ID<sicLL-4iK-11@gated-at.bofh.it>
In reply to#1485233
On Fri, Sep 16, 2016 at 11:33:00AM -0700, Linus Torvalds wrote:
> On Fri, Sep 16, 2016 at 6:25 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > So, once upon a time, in a galaxy far away,..  I did a concurrent
> > pagecache patch set that replaced the tree_lock with a per page bit-
> > spinlock and fine grained locking in the radix tree.
> 
> I'd love to see the patch for that. I'd be a bit worried about extra
> locking in the trivial cases (ie multi-level locking when we now take
> just the single mapping lock), but if there is some smart reason why
> that doesn't happen, then..

On average we'll likely take a few more locks, but its not as bad as
having to take the whole tree depth every time, or even touching the
root lock most times.

There's two cases, the first: the modification is only done on a single
node (like insert), here we do an RCU lookup of the node, lock it,
verify the node is still correct, do modification and unlock, done.

The second case, the modification needs to then back up the tree (like
setting/clearing tags, delete). For this case we can determine on our
way down where the first node is we need to modify, lock that, verify,
and then lock all nodes down to the last. i.e. we lock a partial path.

I can send you the 2.6.31 patches if you're interested, but if you want
something that applies to a kernel from this decade I'll have to go
rewrite them which will take a wee bit of time :-) Both the radix tree
code and the mm have changed somewhat.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web