mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-25 08:34:31 +00:00
mm, vmalloc: use well-defined find_last_bit() func
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 its 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> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
6b70f7dff8
commit
b136be5e0b
1 changed files with 6 additions and 9 deletions
15
mm/vmalloc.c
15
mm/vmalloc.c
|
@ -1016,15 +1016,16 @@ void vm_unmap_aliases(void)
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
list_for_each_entry_rcu(vb, &vbq->free, free_list) {
|
list_for_each_entry_rcu(vb, &vbq->free, free_list) {
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
spin_lock(&vb->lock);
|
spin_lock(&vb->lock);
|
||||||
i = find_first_bit(vb->dirty_map, VMAP_BBMAP_BITS);
|
i = find_first_bit(vb->dirty_map, VMAP_BBMAP_BITS);
|
||||||
while (i < VMAP_BBMAP_BITS) {
|
if (i < VMAP_BBMAP_BITS) {
|
||||||
unsigned long s, e;
|
unsigned long s, e;
|
||||||
int j;
|
|
||||||
j = find_next_zero_bit(vb->dirty_map,
|
j = find_last_bit(vb->dirty_map,
|
||||||
VMAP_BBMAP_BITS, i);
|
VMAP_BBMAP_BITS);
|
||||||
|
j = j + 1; /* need exclusive index */
|
||||||
|
|
||||||
s = vb->va->va_start + (i << PAGE_SHIFT);
|
s = vb->va->va_start + (i << PAGE_SHIFT);
|
||||||
e = vb->va->va_start + (j << PAGE_SHIFT);
|
e = vb->va->va_start + (j << PAGE_SHIFT);
|
||||||
|
@ -1034,10 +1035,6 @@ void vm_unmap_aliases(void)
|
||||||
start = s;
|
start = s;
|
||||||
if (e > end)
|
if (e > end)
|
||||||
end = e;
|
end = e;
|
||||||
|
|
||||||
i = j;
|
|
||||||
i = find_next_bit(vb->dirty_map,
|
|
||||||
VMAP_BBMAP_BITS, i);
|
|
||||||
}
|
}
|
||||||
spin_unlock(&vb->lock);
|
spin_unlock(&vb->lock);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue