[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090526143058.c59e6dc1.akpm@linux-foundation.org>
Date: Tue, 26 May 2009 14:30:58 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Huang Shijie <shijie8@...il.com>
Cc: cl@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, shijie8@...il.com
Subject: Re: [PATCH] lib : provide a more precise
radix_tree_gang_lookup_slot
On Mon, 25 May 2009 11:53:55 +0800
Huang Shijie <shijie8@...il.com> wrote:
> The origin radix_tree_gang_lookup_slot() tries to
> lookup max_items slots.But there are maybe holes for
> find_get_pages_contig() which will only use the contiguous part.
>
> So a more precise radix_tree_gang_lookup_slot() is needed
> to avoid unneccessary search work.
>
OK..
> diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
> index 355f6e8..03e25f4 100644
> --- a/include/linux/radix-tree.h
> +++ b/include/linux/radix-tree.h
> @@ -164,7 +164,8 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
> unsigned long first_index, unsigned int max_items);
> unsigned int
> radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results,
> - unsigned long first_index, unsigned int max_items);
> + unsigned long first_index, unsigned int max_items,
> + int contig);
Variable `contig' could have the type `bool'. Did you consider and
reject that option, or just didn't think of it?
> ...
> + if (contig)
> + goto out;
> +
> + } else if (contig) {
> + index--;
> + goto out;
> +
> + if (contig) {
> + if (slots_found == 0)
> + break;
> + if (next_index & RADIX_TREE_MAP_MASK)
> + break;
> + }
> - (void ***)pages, start, nr_pages);
> + (void ***)pages, start, nr_pages, 0);
> - (void ***)pages, index, nr_pages);
> + (void ***)pages, index, nr_pages, 1);
The patch adds cycles in some cases and saves them in others.
Does the saving exceed the adding? How do we know that the patch is a
net benefit?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists