linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Neil Booth <NeilB@earthling.net>
To: Wang Yong <wangyong@sun475.cs.tsinghua.edu.cn>
Cc: Linux-MM <linux-mm@kvack.org>
Subject: Re: 指鹸 : where does vmlist be initiated?
Date: Sat, 21 Aug 1999 16:43:46 +0900	[thread overview]
Message-ID: <19990821164346.A13013@monkey.rosenet.ne.jp> (raw)
In-Reply-To: <000801beeb7e$5ed16360$0601a8c0@honey.cs.tsinghua.edu.cn>; from Wang Yong on Sat, Aug 21, 1999 at 10:38:57AM +0800

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/

      reply	other threads:[~1999-08-21  7:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-21  2:38 »Ø¸´: " Wang Yong
1999-08-21  7:43 ` Neil Booth [this message]

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=19990821164346.A13013@monkey.rosenet.ne.jp \
    --to=neilb@earthling.net \
    --cc=linux-mm@kvack.org \
    --cc=wangyong@sun475.cs.tsinghua.edu.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox