mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Not Initialize the shrinker->list after kmalloc() in mm/vmscan.c(V2.6.12)?
@ 2007-04-05 11:55 qingxiaoming
  0 siblings, 0 replies; only message in thread
From: qingxiaoming @ 2007-04-05 11:55 UTC (permalink / raw)
  To: linux-kernel

Dear all:
I am reading the function set_shrinker() in mm/vmscan.c of V2.6.12, and I
have a question about the not initialization of list_head,

/*
 * Add a shrinker callback to be called from the vm
 */
struct shrinker *set_shrinker(int seeks, shrinker_t theshrinker)
{
        struct shrinker *shrinker;

        shrinker = kmalloc(sizeof(*shrinker), GFP_KERNEL);
        if (shrinker) {
	        shrinker->shrinker = theshrinker;
	        shrinker->seeks = seeks;
	        shrinker->nr = 0;
	        down_write(&shrinker_rwsem);
	        list_add_tail(&shrinker->list, &shrinker_list);
	        up_write(&shrinker_rwsem);
	}
	return shrinker;
}

As above, the shrinker is allocated from kmalloc, coming from slab
allocator,the list in shrinker is not initialized, directly list_add_tail()
to shrinker_list, don't need to INIT_LIST_HEAD(shrinker->list)?

Thanks,
Best Regards!
Xiaoming.Qing



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-04-05 12:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-05 11:55 Not Initialize the shrinker->list after kmalloc() in mm/vmscan.c(V2.6.12)? qingxiaoming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®