public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Salman Qazi <sqazi@google.com>
Cc: paulmck@us.ibm.com, nickpiggin@yahoo.com.au,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	adurbin@google.com
Subject: Re: [PATCH] Fixed a mismatch between the users of radix_tree and the implementation.
Date: Mon, 16 Aug 2010 13:25:14 +0200	[thread overview]
Message-ID: <1281957914.1926.1249.camel@laptop> (raw)
In-Reply-To: <20100813071735.18763.14706.stgit@bumblebee1.mtv.corp.google.com>

On Fri, 2010-08-13 at 00:20 -0700, Salman Qazi wrote:
> This matters for the lockless page cache, in particular find_get_pages implementation.
> 
> In the following case, we get can get a deadlock:
> 
>     0.  The radix tree contains two items, one has the index 0.
>     1.  The reader (in this case find_get_pages) takes the rcu_read_lock.
>     2.  The reader acquires slot(s) for item(s) including the index 0 item.
>     3.  The non-zero index item is deleted, and as a consequence the other item
>         is moved to the root of the tree.  The place where it used to be is
>         queued for deletion after the readers finish.
>     4.  The reader looks at the index 0 slot, and finds that the page has 0 ref count
>     5.  The reader looks at it again, hoping that the item will either be freed
>         or the ref count will increase.  This never happens, as the slot it
>         is looking at will never be updated.  Also, this slot can never be reclaimed
>         because the reader is holding rcu_read_lock and is in an infinite loop.
> 
> This can be reproduced with reliably by running dbench followed by compilebench under
> autotest.  I have not been able to construct a small targeted repro case.
> 
> There is also a similar potential issue with insertion.  Storing the first
> element in the root and then moving it to a new slot on insertion of a
> second element would potentially lead to a similar problem.
> 
> Both of these issues have been fixed in this change.

Your changelog fails to mention how you fixed it.. 

It also reminds me how much I hate that height hack, I really should get
path-compression working some day...

http://programming.kicks-ass.net/kernel-patches/concurrent-pagecache/23-rc1-rt/radix-tree-path-compression.patch



  reply	other threads:[~2010-08-16 11:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-13  7:15 [PATCH] Fixed a mismatch between the users of radix_tree and the implementation Salman Qazi
2010-08-13  7:20 ` Salman Qazi
2010-08-16 11:25   ` Peter Zijlstra [this message]
2010-08-16 18:30     ` Salman Qazi
2010-08-16 19:33       ` Peter Zijlstra
     [not found]         ` <AANLkTindpUo5tPiXVp6wXjOAqczrJvYegrOMBqSjr4_t@mail.gmail.com>
2010-08-16 21:05           ` Salman Qazi
2010-08-16 21:06           ` Peter Zijlstra
2010-08-17  4:35             ` Salman Qazi
2010-08-17  4:45               ` Salman Qazi
2010-08-17  8:42                 ` Peter Zijlstra
2010-08-17 15:23       ` Nick Piggin
2010-08-17 15:48         ` Peter Zijlstra
2010-08-17 19:49           ` Salman Qazi
2010-08-17 21:28         ` Salman Qazi
2010-08-30 23:27           ` Salman Qazi
2010-11-10 19:16             ` Salman Qazi
2010-11-11  0:29               ` Nick Piggin

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=1281957914.1926.1249.camel@laptop \
    --to=peterz@infradead.org \
    --cc=adurbin@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=paulmck@us.ibm.com \
    --cc=sqazi@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox