Messages in this thread | | | Date | Tue, 9 Nov 1999 14:58:35 +0100 (CET) | From | Mikulas Patocka <> | Subject | Re: PATCH 2.3.26: kmalloc GFP_ZERO |
| |
On 9 Nov 1999, Jes Sorensen wrote:
> >>>>> "Matthew" == Matthew Wilcox <Matthew.Wilcox@genedata.com> writes: > > Matthew> On Tue, Nov 09, 1999 at 10:38:12AM +0100, Jes Sorensen wrote: > >> >>>>> "Jeff" == Jeff Garzik <jgarzik@mandrakesoft.com> writes: > >> > Jeff> Attached is a patch against 2.3.26 which adds the GFP_ZERO flag. > Jeff> There is a lot of code which does > >> > Jeff> ptr = kmalloc(size, ...); memset (ptr, 0, size); > >> By doing this you add another `if' clause to hot path code in the > >> memory allocator, this is IMHO not a very good idea. Let the > >> drivers which know they need zeroed memory, clear it out > >> themselves. > > Matthew> How about a zkmalloc() call which calls kmalloc, then does > Matthew> the memset? It might lead to a small reduction in code size, > Matthew> but it's probably pointless. > > Why, all it does is to provide an obfuscated macro for something which > is not a problem. Right now some code will do kmalloc(); memset();, > it's very clean and easy to deal with.
GFP_ZERO is not so stupid idea. It allows us to implement something like zero-page cache. While processor has nothing to do, it can clear free pages, and when GFP_ZERO request comes, it returns page directly without clearing overhead.
Mikulas Patocka
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |