<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/mm/vmalloc.c, branch v3.17</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.17</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.17'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2014-08-07T01:01:19Z</updated>
<entry>
<title>mm/vmalloc.c: clean up map_vm_area third argument</title>
<updated>2014-08-07T01:01:19Z</updated>
<author>
<name>WANG Chao</name>
<email>chaowang@redhat.com</email>
</author>
<published>2014-08-06T23:06:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f6f8ed47353597dcb895eb4a15a28af657392e72'/>
<id>urn:sha1:f6f8ed47353597dcb895eb4a15a28af657392e72</id>
<content type='text'>
Currently map_vm_area() takes (struct page *** pages) as third argument,
and after mapping, it moves (*pages) to point to (*pages +
nr_mappped_pages).

It looks like this kind of increment is useless to its caller these
days.  The callers don't care about the increments and actually they're
trying to avoid this by passing another copy to map_vm_area().

The caller can always guarantee all the pages can be mapped into vm_area
as specified in first argument and the caller only cares about whether
map_vm_area() fails or not.

This patch cleans up the pointer movement in map_vm_area() and updates
its callers accordingly.

Signed-off-by: WANG Chao &lt;chaowang@redhat.com&gt;
Cc: Zhang Yanfei &lt;zhangyanfei@cn.fujitsu.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Nitin Gupta &lt;ngupta@vflare.org&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>mm, vmalloc: constify allocation mask</title>
<updated>2014-08-07T01:01:18Z</updated>
<author>
<name>David Rientjes</name>
<email>rientjes@google.com</email>
</author>
<published>2014-08-06T23:06:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=930f036b4ff6501b91e09bba4bf94423203dabd9'/>
<id>urn:sha1:930f036b4ff6501b91e09bba4bf94423203dabd9</id>
<content type='text'>
tmp_mask in the __vmalloc_area_node() iteration never changes so it can
be moved into function scope and marked with const.  This causes the
movl and orl to only be done once per call rather than area-&gt;nr_pages
times.

nested_gfp can also be marked const.

Signed-off-by: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>mm/vmalloc.c: add a schedule point to vmalloc()</title>
<updated>2014-08-07T01:01:18Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2014-08-06T23:06:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=660654f90e7f8f6d8163276d47fc1573a39c7007'/>
<id>urn:sha1:660654f90e7f8f6d8163276d47fc1573a39c7007</id>
<content type='text'>
It is not uncommon on busy servers to get stuck hundred of ms in
vmalloc() calls (like file descriptor expansions).

Add a cond_resched() to __vmalloc_area_node() to be gentle to
other tasks.

[akpm@linux-foundation.org: only do it for __GFP_WAIT, per David]
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Hugh Dickins &lt;hughd@google.com&gt;
Acked-by: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>vmalloc: use rcu list iterator to reduce vmap_area_lock contention</title>
<updated>2014-08-07T01:01:15Z</updated>
<author>
<name>Joonsoo Kim</name>
<email>iamjoonsoo.kim@lge.com</email>
</author>
<published>2014-08-06T23:05:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=474750aba88817c53f39424e5567b8e4acc4b39b'/>
<id>urn:sha1:474750aba88817c53f39424e5567b8e4acc4b39b</id>
<content type='text'>
Richard Yao reported a month ago that his system have a trouble with
vmap_area_lock contention during performance analysis by /proc/meminfo.
Andrew asked why his analysis checks /proc/meminfo stressfully, but he
didn't answer it.

  https://lkml.org/lkml/2014/4/10/416

Although I'm not sure that this is right usage or not, there is a
solution reducing vmap_area_lock contention with no side-effect.  That
is just to use rcu list iterator in get_vmalloc_info().

rcu can be used in this function because all RCU protocol is already
respected by writers, since Nick Piggin commit db64fe02258f1 ("mm:
rewrite vmap layer") back in linux-2.6.28

Specifically :
   insertions use list_add_rcu(),
   deletions use list_del_rcu() and kfree_rcu().

Note the rb tree is not used from rcu reader (it would not be safe),
only the vmap_area_list has full RCU protection.

Note that __purge_vmap_area_lazy() already uses this rcu protection.

        rcu_read_lock();
        list_for_each_entry_rcu(va, &amp;vmap_area_list, list) {
                if (va-&gt;flags &amp; VM_LAZY_FREE) {
                        if (va-&gt;va_start &lt; *start)
                                *start = va-&gt;va_start;
                        if (va-&gt;va_end &gt; *end)
                                *end = va-&gt;va_end;
                        nr += (va-&gt;va_end - va-&gt;va_start) &gt;&gt; PAGE_SHIFT;
                        list_add_tail(&amp;va-&gt;purge_list, &amp;valist);
                        va-&gt;flags |= VM_LAZY_FREEING;
                        va-&gt;flags &amp;= ~VM_LAZY_FREE;
                }
        }
        rcu_read_unlock();

Peter:

: While rcu list traversal over the vmap_area_list is safe, this may
: arrive at different results than the spinlocked version. The rcu list
: traversal version will not be a 'snapshot' of a single, valid instant
: of the entire vmap_area_list, but rather a potential amalgam of
: different list states.

Joonsoo:

: Yes, you are right, but I don't think that we should be strict here.
: Meminfo is already not a 'snapshot' at specific time.  While we try to get
: certain stats, the other stats can change.  And, although we may arrive at
: different results than the spinlocked version, the difference would not be
: large and would not make serious side-effect.

[edumazet@google.com: add more commit description]
Signed-off-by: Joonsoo Kim &lt;iamjoonsoo.kim@lge.com&gt;
Reported-by: Richard Yao &lt;ryao@gentoo.org&gt;
Acked-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Cc: Zhang Yanfei &lt;zhangyanfei.yes@gmail.com&gt;
Cc: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Cc: Andi Kleen &lt;andi@firstfloor.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>mm/vmalloc.c: export unmap_kernel_range()</title>
<updated>2014-06-04T23:54:14Z</updated>
<author>
<name>Minchan Kim</name>
<email>minchan@kernel.org</email>
</author>
<published>2014-06-04T23:11:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=93ef6d6ca11382eff03812797da457bc176653a4'/>
<id>urn:sha1:93ef6d6ca11382eff03812797da457bc176653a4</id>
<content type='text'>
zsmalloc needs exported unmap_kernel_range for building as a module.  See
https://lkml.org/lkml/2013/1/18/487

I didn't send a patch to make unmap_kernel_range exportable at that time
because zram was staging stuff and I thought VM function exporting for
staging stuff makes no sense.

Now zsmalloc was promoted.  If we can't build zsmalloc as module, it means
we can't build zram as module, either.  Additionally, buddy map_vm_area is
already exported so let's export unmap_kernel_range to help his buddy.

Signed-off-by: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Nitin Gupta &lt;ngupta@vflare.org&gt;
Cc: Sergey Senozhatsky &lt;sergey.senozhatsky@gmail.com&gt;
Cc: Jerome Marchand &lt;jmarchan@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>mm/vmalloc.c: replace seq_printf by seq_puts</title>
<updated>2014-06-04T23:54:04Z</updated>
<author>
<name>Fabian Frederick</name>
<email>fabf@skynet.be</email>
</author>
<published>2014-06-04T23:08:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f4527c90868d8fa175c68ccf216cf9b67a7d8a1a'/>
<id>urn:sha1:f4527c90868d8fa175c68ccf216cf9b67a7d8a1a</id>
<content type='text'>
Replace seq_printf where possible

Signed-off-by: Fabian Frederick &lt;fabf@skynet.be&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>mm: replace __get_cpu_var uses with this_cpu_ptr</title>
<updated>2014-06-04T23:54:03Z</updated>
<author>
<name>Christoph Lameter</name>
<email>cl@linux.com</email>
</author>
<published>2014-06-04T23:07:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7c8e0181e6e0b8079c4c2ce902bf52d7a2c6fa5d'/>
<id>urn:sha1:7c8e0181e6e0b8079c4c2ce902bf52d7a2c6fa5d</id>
<content type='text'>
Replace places where __get_cpu_var() is used for an address calculation
with this_cpu_ptr().

Signed-off-by: Christoph Lameter &lt;cl@linux.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Hugh Dickins &lt;hughd@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>mm/vmalloc.c: enhance vm_map_ram() comment</title>
<updated>2014-04-07T23:35:55Z</updated>
<author>
<name>Gioh Kim</name>
<email>gioh.kim@lge.com</email>
</author>
<published>2014-04-07T22:37:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3643763834b935208b067db9f4a239aba9dbe28d'/>
<id>urn:sha1:3643763834b935208b067db9f4a239aba9dbe28d</id>
<content type='text'>
vm_map_ram() has a fragmentation problem when it cannot purge a
chunk(ie, 4M address space) if there is a pinning object in that
addresss space.  So it could consume all VMALLOC address space easily.

We can fix the fragmentation problem by using vmap instead of
vm_map_ram() but vmap() is known to be slow compared to vm_map_ram().
Minchan said vm_map_ram is 5 times faster than vmap in his tests.  So I
thought we should fix fragment problem of vm_map_ram because our
proprietary GPU driver has used it heavily.

On second thought, it's not an easy because we should reuse freed space
for solving the problem and it could make more IPI and bitmap operation
for searching hole.  It could mitigate API's goal which is very fast
mapping.  And even fragmentation problem wouldn't show in 64 bit
machine.

Another option is that the user should separate long-life and short-life
object and use vmap for long-life but vm_map_ram for short-life.  If we
inform the user about the characteristic of vm_map_ram the user can
choose one according to the page lifetime.

Let's add some notice messages to user.

[akpm@linux-foundation.org: tweak comment text]
Signed-off-by: Gioh Kim &lt;gioh.kim@lge.com&gt;
Reviewed-by: Zhang Yanfei &lt;zhangyanfei@cn.fujitsu.com&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Cc: Joonsoo Kim &lt;iamjoonsoo.kim@lge.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>mm: use macros from compiler.h instead of __attribute__((...))</title>
<updated>2014-04-07T23:35:54Z</updated>
<author>
<name>Gideon Israel Dsouza</name>
<email>gidisrael@gmail.com</email>
</author>
<published>2014-04-07T22:37:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3b32123d734cb414e366b35a3b2142a995f9d1a0'/>
<id>urn:sha1:3b32123d734cb414e366b35a3b2142a995f9d1a0</id>
<content type='text'>
To increase compiler portability there is &lt;linux/compiler.h&gt; which
provides convenience macros for various gcc constructs.  Eg: __weak for
__attribute__((weak)).  I've replaced all instances of gcc attributes with
the right macro in the memory management (/mm) subsystem.

[akpm@linux-foundation.org: while-we're-there consistency tweaks]
Signed-off-by: Gideon Israel Dsouza &lt;gidisrael@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "mm/vmalloc: interchage the implementation of vmalloc_to_{pfn,page}"</title>
<updated>2014-01-28T05:02:39Z</updated>
<author>
<name>malc</name>
<email>av1474@comtv.ru</email>
</author>
<published>2014-01-28T01:06:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=add688fbd32158440dbe62c07269a39ed969c059'/>
<id>urn:sha1:add688fbd32158440dbe62c07269a39ed969c059</id>
<content type='text'>
Revert commit ece86e222db4, which was intended as a small performance
improvement.

Despite the claim that the patch doesn't introduce any functional
changes in fact it does.

The "no page" path behaves different now.  Originally, vmalloc_to_page
might return NULL under some conditions, with new implementation it
returns pfn_to_page(0) which is not the same as NULL.

Simple test shows the difference.

test.c

#include &lt;linux/kernel.h&gt;
#include &lt;linux/module.h&gt;
#include &lt;linux/vmalloc.h&gt;
#include &lt;linux/mm.h&gt;

int __init myi(void)
{
	struct page *p;
	void *v;

	v = vmalloc(PAGE_SIZE);
	/* trigger the "no page" path in vmalloc_to_page*/
	vfree(v);

	p = vmalloc_to_page(v);

	pr_err("expected val = NULL, returned val = %p", p);

	return -EBUSY;
}

void __exit mye(void)
{

}
module_init(myi)
module_exit(mye)

Before interchange:
expected val = NULL, returned val =   (null)

After interchange:
expected val = NULL, returned val = c7ebe000

Signed-off-by: Vladimir Murzin &lt;murzin.v@gmail.com&gt;
Cc: Jianyu Zhan &lt;nasa4836@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
