[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[microblaze-uclinux] [patch] boot memory allocator cleanup 3 (take 2)



Hi John,

# I don't mean to rush this. I just found some time and seem to found
# the bug.

At Tue, 13 Apr 2004 21:04:25 +1000,
John Williams wrote:
> 
> Hi Yashi,
> 
> Yasushi SHOJI wrote:
> 
> >>Is there anything that assumes .bss will be page aligned?  Otherwise, 
> >>it's some kind of off-by-one or align/reounding error, I think.
> > 
> > 
> > there are some code that assuming boundary is page aligned. I'll look
> > into it.
> 
> The easy fix is just to put
> 
> .bss ALIGN(4096) {
>     ...
> }
> 
> in the link script... but it smells like a hack.. ;-)

It seems I found the problem.  in the old days, we PAGE_ALIGN'ed
__init_begin and __init_end.  This won't work once we changed .bss not
to aligned to page, because that means we are freeing beginig of
section.

this is the relative part of the fix in the attached patch.

@@ -76,11 +73,11 @@
 void free_initmem (void)
 {
 	unsigned long ram_end = ram_start + ram_len;
-	unsigned long start = PAGE_ALIGN ((unsigned long)(__init_begin));
+	unsigned long start = (unsigned long)(__init_begin);
 
 	if (start >= ram_start && start < ram_end) {
 		unsigned long addr;
-		unsigned long end = PAGE_ALIGN ((unsigned long)(__init_end));
+		unsigned long end = (unsigned long)(__init_end);
 
 		if (end > ram_end)
 			end = ram_end;

IMO, the reason previous patch worked on suzaku is pure luck.

regards,
--
         yashi

What the patch does:

* arch/microblaze/kernel/mbvanilla.c: finally used _ramstart
  fixed: _ramstart definition

* arch/microblaze/kernel/suzaku.c: likewise

* arch/microblaze/mbvanilla.ld: remove unsed bootmap section
  
* arch/microblaze/mm/init.c: reserve memory from start of bss to
_ramstart, which is the end of romfs.
  removed: _bootmap fixed:
  fixed: finally use _ramstart
  fixed: don't page align __init_begin and __init_end
         if you do, you are gonna free up bss section

* arch/microblaze/suzaku.ld: remove unused bootmap section
  added: __bss_start and __bss_stop to sync with mbvanilla

Attachment: linux-mm3-get-rid-of-static-bootmap2.patch
Description: Binary data