lkml.org 
[lkml]   [2009]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] slab: initialize unused alien cache entry as NULL at alloc_alien_cache().
On Tue, 22 Dec 2009, Haicheng Li wrote:

> struct array_cache **ac_ptr;
> - int memsize = sizeof(void *) * nr_node_ids;
> + int memsize = sizeof(void *) * MAX_NUMNODES;
> int i;

Why does the alien cache pointer array size have to be increased? node ids
beyond nr_node_ids cannot be used.


>
> if (limit > 1)
> limit = 12;
> ac_ptr = kmalloc_node(memsize, gfp, node);

Use kzalloc to ensure zeroed memory.

> if (ac_ptr) {
> + memset(ac_ptr, 0, memsize);
> for_each_node(i) {
> - if (i == node || !node_online(i)) {
> - ac_ptr[i] = NULL;
> + if (i == node || !node_online(i))
> continue;
> - }
> ac_ptr[i] = alloc_arraycache(node, limit, 0xbaadf00d,
> gfp);
> if (!ac_ptr[i]) {
> for (i--; i >= 0; i--)
>


\
 
 \ /
  Last update: 2009-12-22 16:51    [W:0.215 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site