From: Andrew Morton <akpm@linux-foundation.org>
To: Huang Shijie <shijie8@gmail.com>
Cc: cl@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib : provide a more precise radix_tree_gang_lookup_slot
Date: Tue, 26 May 2009 14:30:58 -0700 [thread overview]
Message-ID: <20090526143058.c59e6dc1.akpm@linux-foundation.org> (raw)
In-Reply-To: <1243223635-3449-1-git-send-email-shijie8@gmail.com>
On Mon, 25 May 2009 11:53:55 +0800
Huang Shijie <shijie8@gmail.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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-05-26 21:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-25 3:53 Huang Shijie
2009-05-26 21:30 ` Andrew Morton [this message]
2009-05-27 7:39 ` Huang Shijie
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=20090526143058.c59e6dc1.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shijie8@gmail.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