* Not Initialize the shrinker->list after kmalloc() in mm/vmscan.c(V2.6.12)?
@ 2007-04-05 11:55 qingxiaoming
0 siblings, 0 replies; 3+ messages 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] 3+ messages in thread* Why is Linux not RTOS?
@ 2007-04-04 12:21 Rick Brown
2007-04-05 11:52 ` Not Initialize the shrinker->list after kmalloc() in mm/vmscan.c(V2.6.12)? qingxiaoming
0 siblings, 1 reply; 3+ messages in thread
From: Rick Brown @ 2007-04-04 12:21 UTC (permalink / raw)
To: linux-newbie, kernelnewbies
Hi,
Why is Linux kernel considered a (hard) realtime OS? I already
understand the basic reason is that the linux kernel does not
guarantee that a task will be completed on time. But I would
appreciate answers in terms of more of kernel jargons.
What stops us from classifying kernel as hard RTOS? Is it because at
times the kernel is non-preemptive (for e.g. while holding spinlocks)?
Has it got something to do with interrupt latency / scheduling latency
etc?
Is the behaviour of the kernel (when it is preemptive) similar to hard
real time OS ??
Thanks,
Rick
-
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Not Initialize the shrinker->list after kmalloc() in mm/vmscan.c(V2.6.12)?
2007-04-04 12:21 Why is Linux not RTOS? Rick Brown
@ 2007-04-05 11:52 ` qingxiaoming
2007-04-09 5:57 ` Rajat Jain
0 siblings, 1 reply; 3+ messages in thread
From: qingxiaoming @ 2007-04-05 11:52 UTC (permalink / raw)
To: linux-newbie, 'kernelnewbies'
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Not Initialize the shrinker->list after kmalloc() in mm/vmscan.c(V2.6.12)?
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
0 siblings, 0 replies; 3+ messages in thread
From: Rajat Jain @ 2007-04-09 5:57 UTC (permalink / raw)
To: qingxiaoming; +Cc: linux-newbie, kernelnewbies
Hi Qing,
On 4/5/07, qingxiaoming <qing_xiaoming@anyka.com> wrote:
> 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)?
>
IMHO, the linked list is not headed by shrinker->list, rather by
shrinker_list. So the statement
list_add_tail(&shrinker->list, &shrinker_list);
is actually adding shrinker to the list shrinker_list. The shrinker->
list is merely a pointer to help in atttaching the node to the list.
Thanks,
Rajat
-
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-04-09 5:57 UTC | newest]
Thread overview: 3+ messages (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
-- 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
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.