From: Ric Mason <ric.masonn@gmail.com>
To: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Andrew Morton <akpm@linux-foundation.org>,
Konstantin Khlebnikov <khlebnikov@openvz.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [patch] mm: shmem: use new radix tree iterator
Date: Wed, 20 Feb 2013 20:16:46 +0800 [thread overview]
Message-ID: <5124BEAE.6060801@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1302031759240.4120@eggly.anvils>
Hi Hugh,
On 02/04/2013 10:01 AM, Hugh Dickins wrote:
> On Fri, 1 Feb 2013, Johannes Weiner wrote:
>
>> In shmem_find_get_pages_and_swap, use the faster radix tree iterator
>> construct from 78c1d78 "radix-tree: introduce bit-optimized iterator".
>>
>> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> Yes, that looks fine, and is testing out fine, thanks.
> Acked-by: Hugh Dickins <hughd@google.com>
Could you share your testcase with me? It seems that you always can test
shmem patches.
>
>> ---
>> mm/shmem.c | 25 ++++++++++++-------------
>> 1 file changed, 12 insertions(+), 13 deletions(-)
>>
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index a368a1c..c5dc8ae 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -336,19 +336,19 @@ static unsigned shmem_find_get_pages_and_swap(struct address_space *mapping,
>> pgoff_t start, unsigned int nr_pages,
>> struct page **pages, pgoff_t *indices)
>> {
>> - unsigned int i;
>> - unsigned int ret;
>> - unsigned int nr_found;
>> + void **slot;
>> + unsigned int ret = 0;
>> + struct radix_tree_iter iter;
>> +
>> + if (!nr_pages)
>> + return 0;
>>
>> rcu_read_lock();
>> restart:
>> - nr_found = radix_tree_gang_lookup_slot(&mapping->page_tree,
>> - (void ***)pages, indices, start, nr_pages);
>> - ret = 0;
>> - for (i = 0; i < nr_found; i++) {
>> + radix_tree_for_each_slot(slot, &mapping->page_tree, &iter, start) {
>> struct page *page;
>> repeat:
>> - page = radix_tree_deref_slot((void **)pages[i]);
>> + page = radix_tree_deref_slot(slot);
>> if (unlikely(!page))
>> continue;
>> if (radix_tree_exception(page)) {
>> @@ -365,17 +365,16 @@ static unsigned shmem_find_get_pages_and_swap(struct address_space *mapping,
>> goto repeat;
>>
>> /* Has the page moved? */
>> - if (unlikely(page != *((void **)pages[i]))) {
>> + if (unlikely(page != *slot)) {
>> page_cache_release(page);
>> goto repeat;
>> }
>> export:
>> - indices[ret] = indices[i];
>> + indices[ret] = iter.index;
>> pages[ret] = page;
>> - ret++;
>> + if (++ret == nr_pages)
>> + break;
>> }
>> - if (unlikely(!ret && nr_found))
>> - goto restart;
>> rcu_read_unlock();
>> return ret;
>> }
>> --
>> 1.7.11.7
> --
> 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>
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Ric Mason <ric.masonn@gmail.com>
To: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Andrew Morton <akpm@linux-foundation.org>,
Konstantin Khlebnikov <khlebnikov@openvz.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [patch] mm: shmem: use new radix tree iterator
Date: Wed, 20 Feb 2013 20:16:46 +0800 [thread overview]
Message-ID: <5124BEAE.6060801@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1302031759240.4120@eggly.anvils>
Hi Hugh,
On 02/04/2013 10:01 AM, Hugh Dickins wrote:
> On Fri, 1 Feb 2013, Johannes Weiner wrote:
>
>> In shmem_find_get_pages_and_swap, use the faster radix tree iterator
>> construct from 78c1d78 "radix-tree: introduce bit-optimized iterator".
>>
>> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> Yes, that looks fine, and is testing out fine, thanks.
> Acked-by: Hugh Dickins <hughd@google.com>
Could you share your testcase with me? It seems that you always can test
shmem patches.
>
>> ---
>> mm/shmem.c | 25 ++++++++++++-------------
>> 1 file changed, 12 insertions(+), 13 deletions(-)
>>
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index a368a1c..c5dc8ae 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -336,19 +336,19 @@ static unsigned shmem_find_get_pages_and_swap(struct address_space *mapping,
>> pgoff_t start, unsigned int nr_pages,
>> struct page **pages, pgoff_t *indices)
>> {
>> - unsigned int i;
>> - unsigned int ret;
>> - unsigned int nr_found;
>> + void **slot;
>> + unsigned int ret = 0;
>> + struct radix_tree_iter iter;
>> +
>> + if (!nr_pages)
>> + return 0;
>>
>> rcu_read_lock();
>> restart:
>> - nr_found = radix_tree_gang_lookup_slot(&mapping->page_tree,
>> - (void ***)pages, indices, start, nr_pages);
>> - ret = 0;
>> - for (i = 0; i < nr_found; i++) {
>> + radix_tree_for_each_slot(slot, &mapping->page_tree, &iter, start) {
>> struct page *page;
>> repeat:
>> - page = radix_tree_deref_slot((void **)pages[i]);
>> + page = radix_tree_deref_slot(slot);
>> if (unlikely(!page))
>> continue;
>> if (radix_tree_exception(page)) {
>> @@ -365,17 +365,16 @@ static unsigned shmem_find_get_pages_and_swap(struct address_space *mapping,
>> goto repeat;
>>
>> /* Has the page moved? */
>> - if (unlikely(page != *((void **)pages[i]))) {
>> + if (unlikely(page != *slot)) {
>> page_cache_release(page);
>> goto repeat;
>> }
>> export:
>> - indices[ret] = indices[i];
>> + indices[ret] = iter.index;
>> pages[ret] = page;
>> - ret++;
>> + if (++ret == nr_pages)
>> + break;
>> }
>> - if (unlikely(!ret && nr_found))
>> - goto restart;
>> rcu_read_unlock();
>> return ret;
>> }
>> --
>> 1.7.11.7
> --
> 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:[~2013-02-20 12:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-01 6:13 [patch] mm: shmem: use new radix tree iterator Johannes Weiner
2013-02-01 6:13 ` Johannes Weiner
2013-02-02 8:25 ` Konstantin Khlebnikov
2013-02-02 8:25 ` Konstantin Khlebnikov
2013-02-04 3:32 ` Hugh Dickins
2013-02-04 3:32 ` Hugh Dickins
2013-02-04 13:29 ` Konstantin Khlebnikov
2013-02-04 13:29 ` Konstantin Khlebnikov
2013-02-05 18:23 ` Johannes Weiner
2013-02-05 18:23 ` Johannes Weiner
2013-02-04 2:01 ` Hugh Dickins
2013-02-04 2:01 ` Hugh Dickins
2013-02-20 12:16 ` Ric Mason [this message]
2013-02-20 12:16 ` Ric Mason
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=5124BEAE.6060801@gmail.com \
--to=ric.masonn@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=khlebnikov@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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.