linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan.kim@gmail.com>
To: naren.mehra@gmail.com
Cc: kamezawa.hiroyu@jp.fujitsu.com, linux-mm@kvack.org
Subject: Re: Need some help in understanding sparsemem.
Date: Wed, 7 Jul 2010 12:49:04 +0900	[thread overview]
Message-ID: <AANLkTim9d3x8oMLxRLyb2EeKCAxFgsOgw2ip87LUOn7z@mail.gmail.com> (raw)
In-Reply-To: <AANLkTin8JIdtSFR-E1J8FwVR2WTivShmZrEoeJWjCd1j@mail.gmail.com>

On Tue, Jul 6, 2010 at 7:48 PM,  <naren.mehra@gmail.com> wrote:
> Thanks Kame for your elaborate response, I got a lot of pointers on
> where to look for in the code.
> Kim, thanks for pointing out memmap_init_zone.
> So basically those sections which contains holes in them, the mem_map
> in those sections skip the entry for the invalid pages (holes).
> This happens in memmap_init_zone().
> 1) So it means that all the sections get the initial allocation of
> mem_map and in memmap_init_zone we decide whether or not it requires

Yes. kernel allocates memmap for non-empty sections.
Even kernel allocates memmap for section which has mixed with valid
and invalid(ex, hole) pages. For example, bank supports 64M but system
have 16M. Let's assume section size is 64M. In this case, section has
hole of 48M.

> any mem_map entry. Correct ??

No. memmap_init_zone doesn't care about it.
Regardless of hole, it initializes page descriptors(include struct
page which on hole).
But page descriptors on holes are _Reserved_ then doesn't go to the
buddy allocator as free page. For it, free_bootmem_node marks 0x0 on
bitmap about only _valid_ pages by bank. Afterwards,
free_all_bootmem_core doesn't insert pages on hole into buddy by using
bitmap. Even memmap on hole would be free on ARM by
free_unused_memmap_node.

>
> 2) Both of you mentioned that
>> "If a section contains both of valid pages and
>> holes, the section itself is marked as SECTION_MARKED_PRESENT."
>> "It just mark _bank_ which has memory with SECTION_MARKED_PRESENT.
>> Otherwise, Hole."
>
> which happens in memory_present(). In memory_present() code, I am not
> able to find anything where we are doing this classification of valid
> section/bank ? To me it looks that memory_present marks, all the
> sections as present and doesnt verify whether any section contains any
> valid pages or not. Correct ??

memory_present is just called on banks.
So some sections which consists of hole don't marked "SECTION_MARKED_PRESENT".

I hope this help you.

-- 
Kind regards,
Minchan Kim

--
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:[~2010-07-07  3:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-06  5:11 Need some help in understanding sparsemem naren.mehra
2010-07-06  6:07 ` KAMEZAWA Hiroyuki
2010-07-06  7:06   ` Minchan Kim
2010-07-06  7:36 ` Minchan Kim
2010-07-06 10:48   ` naren.mehra
2010-07-07  3:49     ` Minchan Kim [this message]
2010-07-09  7:05       ` naren.mehra
2010-07-09  7:49         ` KAMEZAWA Hiroyuki

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=AANLkTim9d3x8oMLxRLyb2EeKCAxFgsOgw2ip87LUOn7z@mail.gmail.com \
    --to=minchan.kim@gmail.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=naren.mehra@gmail.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;
as well as URLs for NNTP newsgroup(s).