[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: =?iso-2022-jp?B?GyRCO1g4NBsoQg==?= : where does vmlist be initiated?
Wang Yong wrote:-
>
> struct vm_struct * get_vm_area(unsigned long size)
> {
> ...
> for (p = &vmlist; (tmp = *p) ; p = &tmp->next) {
> if (size + addr < (unsigned long) tmp->addr)
> ...
> }
> }
[SNIP]
> i think these three functions will not be able to work if vmlist is null. do
> you think so?
They must work as Linux boots. The key is in the snippet I've kept above.
The test in
for (p = &vmlist; (tmp = *p) ; p = &tmp->next) {
is probably more clearly written as
(tmp = *p) != 0
which fails when vmlist is initially zero, so the loop never executes.
Note p does not hold the value of vmlist, but the address of vmlist.
vmlist is then initialised by the
*p = area;
that comes a few lines later.
Neil.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/