linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: C Michael Sundius <Michael.sundius@sciatl.com>
Cc: Andy Whitcroft <apw@shadowen.org>,
	linux-mm@kvack.org, msundius@sundius.com
Subject: Re: Turning on Sparsemem
Date: Tue, 05 Aug 2008 15:19:38 -0700	[thread overview]
Message-ID: <1217974778.10907.82.camel@nimitz> (raw)
In-Reply-To: <4898CE71.60709@sciatl.com>

On Tue, 2008-08-05 at 15:04 -0700, C Michael Sundius wrote:
> still that code is strange to me:
> 
> -------------code
> static inline struct mem_section *__nr_to_section(unsigned long nr)
> {
>         if (!mem_section[SECTION_NR_TO_ROOT(nr)])
>                 return NULL;
>         return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK];
> }
> 
> --------------
> 
> on the first line of the function above, what does it mean "if not 
> <struct>"?  seems that returns true if
> the contents of that struct is "0"... but either way, doesn't that have 
> to be initialized to something before
> it is called from memory_present()?

Yeah, this is confusing code.  The goal here was to not have any #ifdefs
for the normal vs. extreme cases.  In the !EXTREME case, the
mem_section[] array is statically allocated and that first check gets
optimized out completely.  We check for it, but the compiler kills that
check.  

-- Dave

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2008-08-05 22:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-29 18:11 sparcemem or discontig? C Michael Sundius
2008-07-29 21:51 ` Dave Hansen
2008-07-30  9:35   ` Andy Whitcroft
2008-07-30 16:23     ` C Michael Sundius
2008-07-30 16:29       ` Dave Hansen
2008-08-05 21:39       ` Turning on Sparsemem C Michael Sundius
2008-08-05 21:56         ` Dave Hansen
2008-08-05 22:04           ` C Michael Sundius
2008-08-05 22:19             ` Dave Hansen [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=1217974778.10907.82.camel@nimitz \
    --to=dave@linux.vnet.ibm.com \
    --cc=Michael.sundius@sciatl.com \
    --cc=apw@shadowen.org \
    --cc=linux-mm@kvack.org \
    --cc=msundius@sundius.com \
    /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