linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* »Ø¸´: where does vmlist be initiated?
@ 1999-08-21  2:38 Wang Yong
  1999-08-21  7:43 ` 指鹸 : " Neil Booth
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Yong @ 1999-08-21  2:38 UTC (permalink / raw)
  To: Neil Booth; +Cc: linux-mm mail list

-----Original Message-----
.c 1/4 thEE: Neil Booth <NeilB@earthling.net>
EO 1/4 thEE: Wang Yong <wung_y@263.net>
3-EI: Linux-MM <
EOAEU: 1999Ae8OA19EO 4:03
O/Ia: Re: where does vmlist be initiated?


>
>Hi Wang,
>
>There's only 3 lines that reference it in vmalloc.c, so it
>shouldn't be too hard to figure out, no?
>
>Neil.
>

Hi Neil,
  yes, vmlist does only referenced three times in vmalloc.c after it's
defined as NULL. These references are the only reference of vmlist
throughout the whole kernel. let's check them:

struct vm_struct * get_vm_area(unsigned long size)
{
...
 for (p = &vmlist; (tmp = *p) ; p = &tmp->next) {
  if (size + addr < (unsigned long) tmp->addr)
...
 }
}

void vfree(void * addr)
{
 for (p = &vmlist ; (tmp = *p) ; p = &tmp->next) {
...
 }
}

long vread(char *buf, char *addr, unsigned long count)
{
...
 for (tmp = vmlist; tmp; tmp = tmp->next) {
...
 }
}

i think these three functions will not be able to work if vmlist is null. do
you think so?


--
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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: 指鹸 : where does vmlist be initiated?
  1999-08-21  2:38 »Ø¸´: where does vmlist be initiated? Wang Yong
@ 1999-08-21  7:43 ` Neil Booth
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Booth @ 1999-08-21  7:43 UTC (permalink / raw)
  To: Wang Yong; +Cc: Linux-MM

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-08-21  7:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-21  2:38 »Ø¸´: where does vmlist be initiated? Wang Yong
1999-08-21  7:43 ` 指鹸 : " Neil Booth

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