linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wanpeng Li <liwanp@linux.vnet.ibm.com>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Zhang Yanfei <zhangyanfei@cn.fujitsu.com>,
	Joonsoo Kim <js1304@gmail.com>,
	Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH 2/2] mm, vmalloc: use well-defined find_last_bit() func
Date: Fri, 2 Aug 2013 16:28:28 +0800	[thread overview]
Message-ID: <20130802082828.GB14447@hacker.(null)> (raw)
In-Reply-To: <1375408621-16563-2-git-send-email-iamjoonsoo.kim@lge.com>

On Fri, Aug 02, 2013 at 10:57:01AM +0900, Joonsoo Kim wrote:
>Our intention in here is to find last_bit within the region to flush.
>There is well-defined function, find_last_bit() for this purpose and
>it's performance may be slightly better than current implementation.
>So change it.
>
>Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>

>
>diff --git a/mm/vmalloc.c b/mm/vmalloc.c
>index d23c432..93d3182 100644
>--- a/mm/vmalloc.c
>+++ b/mm/vmalloc.c
>@@ -1016,15 +1016,16 @@ void vm_unmap_aliases(void)
>
> 		rcu_read_lock();
> 		list_for_each_entry_rcu(vb, &vbq->free, free_list) {
>-			int i;
>+			int i, j;
>
> 			spin_lock(&vb->lock);
> 			i = find_first_bit(vb->dirty_map, VMAP_BBMAP_BITS);
>-			while (i < VMAP_BBMAP_BITS) {
>+			if (i < VMAP_BBMAP_BITS) {
> 				unsigned long s, e;
>-				int j;
>-				j = find_next_zero_bit(vb->dirty_map,
>-					VMAP_BBMAP_BITS, i);
>+
>+				j = find_last_bit(vb->dirty_map,
>+							VMAP_BBMAP_BITS);
>+				j = j + 1; /* need exclusive index */
>
> 				s = vb->va->va_start + (i << PAGE_SHIFT);
> 				e = vb->va->va_start + (j << PAGE_SHIFT);
>@@ -1034,10 +1035,6 @@ void vm_unmap_aliases(void)
> 					start = s;
> 				if (e > end)
> 					end = e;
>-
>-				i = j;
>-				i = find_next_bit(vb->dirty_map,
>-							VMAP_BBMAP_BITS, i);
> 			}
> 			spin_unlock(&vb->lock);
> 		}
>-- 
>1.7.9.5
>
>--
>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>

  parent reply	other threads:[~2013-08-02  8:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02  1:57 [PATCH 1/2] mm, vmalloc: remove useless variable in vmap_block Joonsoo Kim
2013-08-02  1:57 ` [PATCH 2/2] mm, vmalloc: use well-defined find_last_bit() func Joonsoo Kim
2013-08-02  8:28   ` Wanpeng Li
2013-08-02  8:28   ` Wanpeng Li [this message]
2013-08-02 19:22   ` Johannes Weiner
2013-08-03  0:46   ` Yanfei Zhang
2013-08-02  8:14 ` [PATCH 1/2] mm, vmalloc: remove useless variable in vmap_block Wanpeng Li
2013-08-02  8:14 ` Wanpeng Li
2013-08-02 19:15 ` Johannes Weiner
2013-08-03  0:38 ` Yanfei Zhang
2013-08-03  0:44   ` Yanfei Zhang

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='20130802082828.GB14447@hacker.(null)' \
    --to=liwanp@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=zhangyanfei@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).