All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@kernel.dk>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	jack@suse.cz, npiggin@kernel.dk
Subject: Re: [PATCH 1/2] radix-tree: clear all tags in radix_tree_node_rcu_free
Date: Fri, 20 Aug 2010 18:00:39 +1000	[thread overview]
Message-ID: <20100820080039.GB3777@amd> (raw)
In-Reply-To: <1282281727-15088-2-git-send-email-david@fromorbit.com>

On Fri, Aug 20, 2010 at 03:22:06PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> Commit f446daaea9d4a420d16c606f755f3689dcb2d0ce ("mm: implement
> writeback livelock avoidance using page tagging") introduced a new
> radix tree tag, increasing the number of tags in each node from 2 to
> 3. It did not, however, fix up the code in
> radix_tree_node_rcu_free() that cleans up after radix_tree_shrink()
> and hence could leave stray tags set in the new tag array.
> 
> The result is that the livelock avoidance code added in the the
> above commit would hit stale tags when doing tag based lookups,
> resulting in livelocks when trying to traverse the tree.
> 
> Fix this problem in radix_tree_node_rcu_free() so it doesn't happen
> again in the future by using a loop to walk all the tags up to
> RADIX_TREE_MAX_TAGS to clear the stray tags radix_tree_shrink()
> leaves behind.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

Acked-by: Nick Piggin <npiggin@kernel.dk>

> ---
>  lib/radix-tree.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/radix-tree.c b/lib/radix-tree.c
> index e907858..1014171 100644
> --- a/lib/radix-tree.c
> +++ b/lib/radix-tree.c
> @@ -174,14 +174,16 @@ static void radix_tree_node_rcu_free(struct rcu_head *head)
>  {
>  	struct radix_tree_node *node =
>  			container_of(head, struct radix_tree_node, rcu_head);
> +	int i;
>  
>  	/*
>  	 * must only free zeroed nodes into the slab. radix_tree_shrink
>  	 * can leave us with a non-NULL entry in the first slot, so clear
>  	 * that here to make sure.
>  	 */
> -	tag_clear(node, 0, 0);
> -	tag_clear(node, 1, 0);
> +	for (i = 0; i < RADIX_TREE_MAX_TAGS; i++)
> +		tag_clear(node, i, 0);
> +
>  	node->slots[0] = NULL;
>  	node->count = 0;
>  
> -- 
> 1.7.1

  reply	other threads:[~2010-08-20  8:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20  5:22 [PATCH 0/2] radix-tree: fix writeback livelock avoidance code Dave Chinner
2010-08-20  5:22 ` [PATCH 1/2] radix-tree: clear all tags in radix_tree_node_rcu_free Dave Chinner
2010-08-20  8:00   ` Nick Piggin [this message]
2010-08-20 13:00   ` Jan Kara
2010-08-20  5:22 ` [PATCH 2/2] radix-tree: radix_tree_range_tag_if_tagged() can set incorrect tags Dave Chinner
2010-08-20  8:02   ` Nick Piggin
2010-08-20 13:39   ` Jan Kara
2010-08-20 13:51 ` [PATCH 0/2] radix-tree: fix writeback livelock avoidance code Jan Kara
2010-08-20 14:29   ` Dave Chinner
2010-08-25 20:11 ` Jan Kara

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=20100820080039.GB3777@amd \
    --to=npiggin@kernel.dk \
    --cc=david@fromorbit.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.