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

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
any mem_map entry. Correct ??

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

void __init memory_present(int nid, unsigned long start, unsigned long end)
{
        unsigned long pfn;

        start &= PAGE_SECTION_MASK;
        mminit_validate_memmodel_limits(&start, &end);
        for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) {
                unsigned long section = pfn_to_section_nr(pfn);
          <--- find out the section no. of the given pfn
                struct mem_section *ms;

                sparse_index_init(section, nid);
                     <---- allocate a new section pointer to the
mem_section array
                set_section_nid(section, nid);
                      <---- store the node id for the particular page.

                ms = __nr_to_section(section);
                     <---- get the pointer to the mem_section
                if (!ms->section_mem_map)
                     <--- mark present, if not already marked.
                        ms->section_mem_map = sparse_encode_early_nid(nid) |
                                                        SECTION_MARKED_PRESENT;
        }
}

I know, I am missing something very simple... pls point it out. if possible.

Regards,
Naren

On Tue, Jul 6, 2010 at 1:06 PM, Minchan Kim <minchan.kim@gmail.com> wrote:
> On Tue, Jul 6, 2010 at 2:11 PM,  <naren.mehra@gmail.com> wrote:
>> Hi,
>>
>> I am trying to understand the sparsemem implementation in linux for
>> NUMA/multiple node systems.
>>
>> From the available documentation and the sparsemem patches, I am able
>> to make out that sparsemem divides memory into different sections and
>> if the whole section contains a hole then its marked as invalid
>> section and if some pages in a section form a hole then those pages
>> are marked reserved. My issue is that this classification, I am not
>> able to map it to the code.
>>
>> e.g. from arch specific code, we call memory_present()  to prepare a
>> list of sections in a particular node. but unable to find where
>> exactly some sections are marked invalid because they contain a hole.
>
> On ARM's sparsememory,
>
> static void arm_memory_present(struct meminfo *mi)
> {
>        int i;
>        for_each_bank(i, mi) {
>                struct membank *bank = &mi->bank[i];
>                memory_present(0, bank_pfn_start(bank), bank_pfn_end(bank));
>        }
> }
>
> It just mark _bank_ which has memory with SECTION_MARKED_PRESENT.
> Otherwise, Hole.
>
>>
>> Can somebody tell me where in the code are we identifying sections as
>> invalid and where we are marking pages as reserved.
>
> Do you mean memmap_init_zone?
>
>
> --
> 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-06 10:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-06  5:11 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 [this message]
2010-07-07  3:49     ` Minchan Kim
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=AANLkTin8JIdtSFR-E1J8FwVR2WTivShmZrEoeJWjCd1j@mail.gmail.com \
    --to=naren.mehra@gmail.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@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