Have ever checked in your mips sparsemem code into mips-linux tree?
Subsystems (2)
adding patch 2 containing Documentation:
- - - - - Cisco - - - - -
This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
On Mon, Oct 06, 2008 at 01:15:49PM -0700, C Michael Sundius wrote:
Btw, I'm planning to rip support for discontig memory from MIPS. IP27 is the only platform using it and it also would be better off using sparsemem instead.
Ralf
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Thank you Michael! I will try it out, and will post results later, but not next couple of days, since I have some stuff on hands approaching the deadline.
John
Quoted 163 lines · C Michael Sundius
From: C Michael Sundius <[email protected]>
Subject: Re: Have ever checked in your mips sparsemem code into mips-linux tree?
To: "Andy Whitcroft" <[email protected]>, "Dave Hansen" <[email protected]>, [email protected], [email protected], "VomLehn, David" <[email protected]>, [email protected]
Date: Monday, October 6, 2008, 1:15 PM
adding patch 2 containing Documentation:- - - - - Cisco
- - - - -
This e-mail and any attachments may contain information which is confidential,
proprietary, privileged or otherwise protected by law. The information is solely
intended for the named addressee (or a person responsible for delivering it to
the addressee). If you are not the intended recipient of this message, you are
not authorized to read, print, retain, copy or disseminate this message or any
part of it. If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your computer.Frome01ad377b29c0e5c39289bece382e1f78f6e7e2cMonSep 17 00:00:00 2001From: Sundis <[email protected]>
Date: Mon, 6 Oct 2008 10:31:08 -0700
Subject: [PATCH] mips sparsemem howto--- Documentation/sparsemem.txt | 92 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 92 insertions(+), 0 deletions(-) create mode 100644 Documentation/sparsemem.txtDocumentation/sparsemem.txt new file +1
-0@@ -0,0 +1,92 @@ +Sparsemem divides up physical memory in your system into Nsections of M
+bytes. Page tables are created for only those sections that
+actually exist (as far as the sparsemem code is concerned). This allows
+for holes in the physical memory without having to waste space by
+creating page descriptors for those pages that do not exist.
+Whenpage_to_pfn()orpfn_to_page()are called there is a bit of overhead to
+look up the proper memory section to get to thepage_table, but this
+is small compared to the memory you are likely to save. So, it's not the
+default, but should be used if you have big holes in physical memory.Documentation/sparsemem.txt new file +2
-0+ +Note that discontiguous memory is more closely related toNUMA machines
+and if you are a single CPU system use sparsemem and not discontig.Documentation/sparsemem.txt new file +4
-0+It's much simpler. + +1) CALL MEMORY_PRESENT() +Existing sections are recorded once the bootmem allocatoris up and running by
+calling the sparsemem function "memory_present(node, pfn_start, pfn_end)" for each
+block of memory that exists in your physical address space. The
+memory_present() function records valid sections in a data structure calledDocumentation/sparsemem.txt new file +9
-0+mem_section[]. + +2) DETERMINE AND SET THE SIZE OF SECTIONS AND PHYSMEM +The size of N and M above depend upon your architecture +and your platform and are specified in the file: + + include/asm-<your_arch>/sparsemem.h + +and you should create the following lines similar tobelow:
Documentation/sparsemem.txt new file +9
-0+ + #ifdef CONFIG_YOUR_PLATFORM + #define SECTION_SIZE_BITS 27 /* 128 MiB */ + #endif + #define MAX_PHYSMEM_BITS 31 /* 2 GiB */ + +if they don't already exist, where: + + * SECTION_SIZE_BITS 2^M: how big each sectionwill be
+ *MAX_PHYSMEM_BITS2^N: how much memory we
can have in thatDocumentation/sparsemem.txt new file +4
-0+ space + +3) INITIALIZE SPARSE MEMORY +You should make sure that you initialize the sparse memorycode by calling
Documentation/sparsemem.txt new file +6
-0+ + bootmem_init(); + + sparse_init(); + paging_init(); + +just before you call paging_init() and after the
bootmem_allocatorisDocumentation/sparsemem.txt new file +8
-0+turned on in your setup_arch() code. + +4) ENABLE SPARSEMEM IN KCONFIG +Add a line like this: + + select ARCH_SPARSEMEM_ENABLE + +into the config for your platform inarch/<your_arch>/Kconfig. This will
+ensure that turning on sparsemem is enabled for your platform.Documentation/sparsemem.txt new file +4
-0+ +5) CONFIG +Run make *config, as you like, and turn on the sparsemem +memory model under the "Kernel Type" -->"Memory Model" and then build your
Documentation/sparsemem.txt new file +6
-0+kernel. + + +6) Gotchas + +One trick that I encountered when I was turning this onfor MIPS was that there
+was some code inmem_init()that set the "reserved" flag for pages that were not
+valid RAM. This caused my kernel to crash when I enabled sparsemem since those
+pages (and page descriptors) didn't actually exist. I changed my code by addingDocumentation/sparsemem.txt new file +17
-0+lines like below: + + + for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) { + struct page *page = pfn_to_page(tmp); + + + if (!pfn_valid(tmp)) + + continue; + + + if (!page_is_ram(tmp)) { + SetPageReserved(page); + continue; + } + ClearPageReserved(page); + init_page_count(page); + __free_page(page); + physmem_record(PFN_PHYS(tmp), PAGE_SIZE,
physmem_highmem);Documentation/sparsemem.txt new file +5
-0+ totalhigh_pages++; + } + + +Once I got that straight, it worked!!!! I saved 10MiB of
Quoted 3 lines
memory.
Signature · 1 line
1.5.4.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>