All of lore.kernel.org
 help / color / mirror / Atom feed
From: "qingxiaoming" <qing_xiaoming@anyka.com>
To: <linux-kernel@vger.kernel.org>
Subject: Not Initialize the shrinker->list after kmalloc() in mm/vmscan.c(V2.6.12)?
Date: Thu, 5 Apr 2007 19:55:01 +0800	[thread overview]
Message-ID: <003801c77779$3df8c450$160710ac@qingxiaoming> (raw)

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



             reply	other threads:[~2007-04-05 12:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-05 11:55 qingxiaoming [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-04-04 12:21 Why is Linux not RTOS? Rick Brown
2007-04-05 11:52 ` Not Initialize the shrinker->list after kmalloc() in mm/vmscan.c(V2.6.12)? qingxiaoming
2007-04-09  5:57   ` Rajat Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003801c77779$3df8c450$160710ac@qingxiaoming' \
    --to=qing_xiaoming@anyka.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.