All of lore.kernel.org
 help / color / mirror / Atom feed
From: "qingxiaoming" <qing_xiaoming@anyka.com>
To: linux-newbie@vger.kernel.org,
	'kernelnewbies' <kernelnewbies@nl.linux.org>
Subject: Not Initialize the shrinker->list after kmalloc() in mm/vmscan.c(V2.6.12)?
Date: Thu, 5 Apr 2007 19:52:15 +0800	[thread overview]
Message-ID: <003701c77778$db000160$160710ac@qingxiaoming> (raw)
In-Reply-To: <7783925d0704040521q3755394uf774884b5298eec2@mail.gmail.com>

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


-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

  parent reply	other threads:[~2007-04-05 11:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-04 12:21 Why is Linux not RTOS? Rick Brown
2007-04-04 13:00 ` John Anthony Kazos Jr.
2007-04-04 13:05   ` Rick Brown
2007-04-04 15:21     ` Daniel Cheng
2007-04-05  9:36       ` Tzahi Fadida
2007-04-05 10:05         ` sandeep lahane
2007-04-05 10:11           ` Raseel Bhagat
2007-04-05 10:23             ` sandeep lahane
2007-04-05 13:28               ` Mark Hounschell
2007-04-05 10:07         ` Raseel Bhagat
2007-05-30  0:47           ` Rodrigo Rubira Branco
2007-05-31  1:16             ` K.R. Foley
2007-04-05  7:14 ` Pradeep
2007-04-05  9:01   ` Raseel Bhagat
2007-04-05  9:05     ` Pharaoh .
2007-04-05 11:52 ` qingxiaoming [this message]
2007-04-09  5:57   ` Not Initialize the shrinker->list after kmalloc() in mm/vmscan.c(V2.6.12)? Rajat Jain
  -- strict thread matches above, loose matches on Subject: below --
2007-04-05 11:55 qingxiaoming

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='003701c77778$db000160$160710ac@qingxiaoming' \
    --to=qing_xiaoming@anyka.com \
    --cc=kernelnewbies@nl.linux.org \
    --cc=linux-newbie@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.