lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 17 Oct 2010 13:50:45 +0900
From:	Minchan Kim <minchan.kim@...il.com>
To:	Dave Young <hidave.darkstar@...il.com>
Cc:	linux-kernel@...r.kernel.org, linux-mm@...ck.org,
	kvm@...r.kernel.org, Nick Piggin <npiggin@...nel.dk>
Subject: Re: [PATCH 1/2] Add vzalloc shortcut

On Sat, Oct 16, 2010 at 1:33 PM, Dave Young <hidave.darkstar@...il.com> wrote:
> Add vzalloc for convinience of vmalloc-then-memset-zero case
>
> Use __GFP_ZERO in vzalloc to zero fill the allocated memory.
Looks good to me.

There are many place we need this.
Although it affects meta pages for vmalloc as well as data pages, it's
not a big.
In this case, Maintaining code simple is better than little bit
performance overhead.

>
> Signed-off-by: Dave Young <hidave.darkstar@...il.com>
Reviewed-by: Minchan Kim <minchan.kim@...il.com>

Isn't it useful in nommu, either?


> ---
>  include/linux/vmalloc.h |    1 +
>  mm/vmalloc.c            |   13 +++++++++++++
>  2 files changed, 14 insertions(+)
>
> --- linux-2.6.orig/include/linux/vmalloc.h      2010-08-22 15:31:38.000000000 +0800
> +++ linux-2.6/include/linux/vmalloc.h   2010-10-16 10:50:54.739996121 +0800
> @@ -53,6 +53,7 @@ static inline void vmalloc_init(void)
>  #endif
>
>  extern void *vmalloc(unsigned long size);
> +extern void *vzalloc(unsigned long size);
>  extern void *vmalloc_user(unsigned long size);
>  extern void *vmalloc_node(unsigned long size, int node);
>  extern void *vmalloc_exec(unsigned long size);
> --- linux-2.6.orig/mm/vmalloc.c 2010-08-22 15:31:39.000000000 +0800
> +++ linux-2.6/mm/vmalloc.c      2010-10-16 10:51:57.126665918 +0800
> @@ -1604,6 +1604,19 @@ void *vmalloc(unsigned long size)
>  EXPORT_SYMBOL(vmalloc);
>
>  /**
> + *     vzalloc  -  allocate virtually contiguous memory with zero filled
> + *     @size:          allocation size
> + *     Allocate enough pages to cover @size from the page level
> + *     allocator and map them into contiguous kernel virtual space.
> + */
> +void *vzalloc(unsigned long size)
> +{
> +       return __vmalloc_node(size, 1, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,
> +                               PAGE_KERNEL, -1, __builtin_return_address(0));
> +}
> +EXPORT_SYMBOL(vzalloc);
> +
> +/**
>  * vmalloc_user - allocate zeroed virtually contiguous memory for userspace
>  * @size: allocation size
>  *
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@...ck.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@...ck.org"> email@...ck.org </a>
>
>



-- 
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ