lkml.org 
[lkml]   [2010]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] cgroup: Avoid a memset by using vzalloc
    Hi,

    We can avoid doing a memset in swap_cgroup_swapon() by using vzalloc().


    Signed-off-by: Jesper Juhl <jj@chaosbits.net>
    ---
    compile tested only.
    page_cgroup.c | 3 +--
    1 file changed, 1 insertion(+), 2 deletions(-)

    diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
    index 5bffada..34970c7 100644
    --- a/mm/page_cgroup.c
    +++ b/mm/page_cgroup.c
    @@ -450,11 +450,10 @@ int swap_cgroup_swapon(int type, unsigned long max_pages)
    length = ((max_pages/SC_PER_PAGE) + 1);
    array_size = length * sizeof(void *);

    - array = vmalloc(array_size);
    + array = vzalloc(array_size);
    if (!array)
    goto nomem;

    - memset(array, 0, array_size);
    ctrl = &swap_cgroup_ctrl[type];
    mutex_lock(&swap_cgroup_mutex);
    ctrl->length = length;
    --
    Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
    Plain text mails only, please http://www.expita.com/nomime.html
    Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html



    \
     
     \ /
      Last update: 2010-10-30 23:49    [W:0.019 / U:30.200 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site