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


Groups > linux.kernel > #1695880 > unrolled thread

Re: [PATCH v7 08/16] lockdep: Avoid adding redundant direct links of crosslocks

Started byPeter Zijlstra <peterz@infradead.org>
First post2017-07-25 17:50 +0200
Last post2017-07-26 09:20 +0200
Articles 2 — 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 v7 08/16] lockdep: Avoid adding redundant direct links of  crosslocks Peter Zijlstra <peterz@infradead.org> - 2017-07-25 17:50 +0200
    Re: [PATCH v7 08/16] lockdep: Avoid adding redundant direct links of  crosslocks Byungchul Park <byungchul.park@lge.com> - 2017-07-26 09:20 +0200

#1695880 — Re: [PATCH v7 08/16] lockdep: Avoid adding redundant direct links of crosslocks

FromPeter Zijlstra <peterz@infradead.org>
Date2017-07-25 17:50 +0200
SubjectRe: [PATCH v7 08/16] lockdep: Avoid adding redundant direct links of crosslocks
Message-ID<u7afV-4DI-43@gated-at.bofh.it>
On Wed, May 24, 2017 at 05:59:41PM +0900, Byungchul Park wrote:
> We can skip adding a dependency 'AX -> B', in case that we ensure 'AX ->
> the previous of B in hlocks' to be created, where AX is a crosslock and
> B is a typical lock. Remember that two adjacent locks in hlocks generate
> a dependency like 'prev -> next', that is, 'the previous of B in hlocks
> -> B' in this case.
> 
> For example:
> 
>              in hlocks[]
>              ------------
>           ^  A (gen_id: 4) --+
>           |                  | previous gen_id
>           |  B (gen_id: 3) <-+
>           |  C (gen_id: 3)
>           |  D (gen_id: 2)
>    oldest |  E (gen_id: 1)
> 
>              in xhlocks[]
>              ------------
>           ^  A (gen_id: 4, prev_gen_id: 3(B's gen id))
>           |  B (gen_id: 3, prev_gen_id: 3(C's gen id))
>           |  C (gen_id: 3, prev_gen_id: 2(D's gen id))
>           |  D (gen_id: 2, prev_gen_id: 1(E's gen id))
>    oldest |  E (gen_id: 1, prev_gen_id: NA)
> 
> On commit for a crosslock AX(gen_id = 3), it's engough to add 'AX -> C',
> but adding 'AX -> B' and 'AX -> A' is unnecessary since 'AX -> C', 'C ->
> B' and 'B -> A' cover them, which are guaranteed to be generated.
> 
> This patch intoduces a variable, prev_gen_id, to avoid adding this kind
> of redundant dependencies. In other words, the previous in hlocks will
> anyway handle it if the previous's gen_id >= the crosslock's gen_id.
> 

Didn't we talk about an alternative to this?

/me goes dig

 https://lkml.kernel.org/r/20170303091338.GH6536@twins.programming.kicks-ass.net

There and replies.

So how much does this save vs avoiding redundant links?

[toc] | [next] | [standalone]


#1696836

FromByungchul Park <byungchul.park@lge.com>
Date2017-07-26 09:20 +0200
Message-ID<u7oLU-5HO-11@gated-at.bofh.it>
In reply to#1695880
On Tue, Jul 25, 2017 at 05:41:36PM +0200, Peter Zijlstra wrote:
> On Wed, May 24, 2017 at 05:59:41PM +0900, Byungchul Park wrote:
> > We can skip adding a dependency 'AX -> B', in case that we ensure 'AX ->
> > the previous of B in hlocks' to be created, where AX is a crosslock and
> > B is a typical lock. Remember that two adjacent locks in hlocks generate
> > a dependency like 'prev -> next', that is, 'the previous of B in hlocks
> > -> B' in this case.
> > 
> > For example:
> > 
> >              in hlocks[]
> >              ------------
> >           ^  A (gen_id: 4) --+
> >           |                  | previous gen_id
> >           |  B (gen_id: 3) <-+
> >           |  C (gen_id: 3)
> >           |  D (gen_id: 2)
> >    oldest |  E (gen_id: 1)
> > 
> >              in xhlocks[]
> >              ------------
> >           ^  A (gen_id: 4, prev_gen_id: 3(B's gen id))
> >           |  B (gen_id: 3, prev_gen_id: 3(C's gen id))
> >           |  C (gen_id: 3, prev_gen_id: 2(D's gen id))
> >           |  D (gen_id: 2, prev_gen_id: 1(E's gen id))
> >    oldest |  E (gen_id: 1, prev_gen_id: NA)
> > 
> > On commit for a crosslock AX(gen_id = 3), it's engough to add 'AX -> C',
> > but adding 'AX -> B' and 'AX -> A' is unnecessary since 'AX -> C', 'C ->
> > B' and 'B -> A' cover them, which are guaranteed to be generated.
> > 
> > This patch intoduces a variable, prev_gen_id, to avoid adding this kind
> > of redundant dependencies. In other words, the previous in hlocks will
> > anyway handle it if the previous's gen_id >= the crosslock's gen_id.
> > 
> 
> Didn't we talk about an alternative to this?

Yes, we did. You said the optimazation was unnecessary, and I was not
sure if it's true, so added it at this time.

But *I will exclude this from next spin*.

> 
> /me goes dig
> 
>  https://lkml.kernel.org/r/20170303091338.GH6536@twins.programming.kicks-ass.net
> 
> There and replies.
> 
> So how much does this save vs avoiding redundant links?

No different on my qemu machine. The answer was:

https://lkml.org/lkml/2017/3/14/103

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web