From: Andy Whitcroft <apw@shadowen.org>
To: moreau francis <francis_moreau2000@yahoo.fr>
Cc: linux-kernel@vger.kernel.org
Subject: Re: sparsemem usage
Date: Wed, 02 Aug 2006 15:25:10 +0100 [thread overview]
Message-ID: <44D0B5C6.1040006@shadowen.org> (raw)
In-Reply-To: <20060802134413.63901.qmail@web25814.mail.ukl.yahoo.com>
moreau francis wrote:
> My board has a really weird mem mapping.
>
> MEM1: 0xc000 0000 - 32 Mo
> MEM2: 0xd000 0000 - 8 Mo
> MEM3: 0xd800 0000 - 128 Ko
>
> MEM3 has interesting properties, such as speed and security,
> and I really need to use it.
>
> I think that sparsemem can deal with such mapping. But I
> encounter an issue when choosing the section bit size. I choose
> SECTION_SIZE_BITS = 17. Therefore the section size is
> equal to the smallest size of my memories. But I get a
> compilation error which is due to this:
>
> #if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS
> #error Allocator MAX_ORDER exceeds SECTION_SIZE
> #endif
>
> I'm not sure to understand why there's such check. To fix this
> I should change MAX_ORDER to 6.
>
> Is it the only way to fix that ?
The memory allocator buddy location algorithm has an implicit assumption
that the memory map will be contigious and valid out to MAX_ORDER. ie
that we can do relative arithmetic on a page* for a page to find its
buddy at all times. The allocator never looks outside a MAX_ORDER
block, aligned to MAX_ORDER in physical pages. SPARSEMEM's
implementation by it nature breaks up the mem_map at the section size.
Thus for the buddy to work a section must be >= MAX_ORDER in size to
maintain the contiguity constraint.
However, just because you have a small memory block in your memory map
doesn't mean that the sparsemem section size needs to be that small to
match. If there is any valid memory in any section that section will be
instantiated and the valid memory marked within it, any invalid memory
is marked reserved. The section size bounds the amount of internal
fragmentation we can have in the mem_map. SPARSEMEM as its name
suggests wins biggest when memory is very sparsly populate. If I am
reading correctly your memory is actually contigious.
-apw
next prev parent reply other threads:[~2006-08-02 14:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-02 13:44 sparsemem usage moreau francis
2006-08-02 14:25 ` Andy Whitcroft [this message]
2006-08-02 15:12 ` Re : " moreau francis
2006-08-02 15:36 ` Andy Whitcroft
2006-08-03 9:56 ` Re : " moreau francis
2006-08-02 15:24 ` Alan Cox
2006-08-02 15:33 ` Re : " moreau francis
2006-08-02 16:33 ` Alan Cox
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=44D0B5C6.1040006@shadowen.org \
--to=apw@shadowen.org \
--cc=francis_moreau2000@yahoo.fr \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.