lkml.org 
[lkml]   [1999]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Memory details not shown for 2.3.26
Miles Lane wrote:

> Linux version 2.3.26 (root@nightlight.amazon.com) (gcc version 2.95.1
> 19990816 (release)) #27 Sun Nov 7 11:51:46 PST 1999
> Memory: 78868k/81920k available (0k kernel code, 0k reserved, 0k data,
> 0k init, 0k highmem)
>
> Miles
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/

Here is a patch for the problem. One difference is that a lot of memory
that was displayed as "data" is now displayed as "reserved". This is due
to the way memory is reserved at boot time in 2.3.x.


before>>> Nov 9 16:14:38 test kernel: Memory: 900600k/917504k available (0k
kernel code, 0k reserved, 0k data, 0k init, 0k highmem)


after>>> Nov 9 17:43:04 test kernel: Memory: 900600k/917504k available
(1344k kernel code, 15396k reserved, 120k data, 72k init, 0k highmem)



Larry Woodman
http://www.missioncriticallinux.com


diff -u --recursive --new-file linux-2.3.25.vanilla/Makefile linux-2.3.25/Makefile
--- linux-2.3.25.vanilla/Makefile Fri Oct 29 18:38:02 1999
+++ linux-2.3.25/Makefile Thu Nov 4 11:06:55 1999
@@ -86,7 +86,7 @@
# standard CFLAGS
#

-CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+CFLAGS = -Wall -Wstrict-prototypes -O2 -g

# use '-fno-strict-aliasing', but only if the compiler can take it
CFLAGS += $(shell if $(CC) -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-fno-strict-aliasing"; fi)
diff -u --recursive --new-file linux-2.3.25.vanilla/arch/i386/mm/init.c linux-2.3.25/arch/i386/mm/init.c
--- linux-2.3.25.vanilla/arch/i386/mm/init.c Wed Oct 20 14:32:17 1999
+++ linux-2.3.25/arch/i386/mm/init.c Tue Nov 9 17:17:40 1999
@@ -516,7 +516,7 @@
memset(empty_zero_page, 0, PAGE_SIZE);

/* this will put all low memory onto the freelists */
- totalram_pages += free_all_bootmem();
+ totalram_pages += free_all_bootmem(&codepages, &reservedpages, &datapages, &initpages);

#ifdef CONFIG_HIGHMEM
for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
diff -u --recursive --new-file linux-2.3.25.vanilla/include/linux/bootmem.h linux-2.3.25/include/linux/bootmem.h
--- linux-2.3.25.vanilla/include/linux/bootmem.h Mon Nov 1 16:39:18 1999
+++ linux-2.3.25/include/linux/bootmem.h Tue Nov 9 17:15:42 1999
@@ -21,7 +21,7 @@
__alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
#define alloc_bootmem_low_pages(x) \
__alloc_bootmem((x), PAGE_SIZE, 0)
-extern unsigned long __init free_all_bootmem (void);
+extern unsigned long __init free_all_bootmem (int*, int*, int*, int*);

#endif /* _LINUX_BOOTMEM_H */

diff -u --recursive --new-file linux-2.3.25.vanilla/ipc/shm.c linux-2.3.25/ipc/shm.c
--- linux-2.3.25.vanilla/ipc/shm.c Fri Oct 29 18:07:16 1999
+++ linux-2.3.25/ipc/shm.c Wed Nov 3 16:32:26 1999
@@ -788,7 +788,7 @@
unlock_kernel();
return 0;
}
- if (page_count(page_map))
+ if (page_count(page_map) != 1)
goto check_table;
if (!(page_map = prepare_highmem_swapout(page_map)))
goto check_table;
diff -u --recursive --new-file linux-2.3.25.vanilla/mm/bootmem.c linux-2.3.25/mm/bootmem.c
--- linux-2.3.25.vanilla/mm/bootmem.c Wed Oct 20 19:46:42 1999
+++ linux-2.3.25/mm/bootmem.c Tue Nov 9 17:39:08 1999
@@ -196,8 +196,8 @@

return ret;
}
-
-unsigned long __init free_all_bootmem (void)
+extern char _text, _etext, _edata, __init_begin, __init_end, __bss_start;
+unsigned long __init free_all_bootmem (int *codepages, int *reservedpages, int *datapages, int *initpages)
{
struct page * page;
unsigned long i, count, total = 0;
@@ -214,6 +214,20 @@
if (i >= (__pa(MAX_DMA_ADDRESS) >> PAGE_SHIFT))
clear_bit(PG_DMA, &page->flags);
__free_page(page);
+ } else {
+ unsigned long addr = (unsigned long)(i<<PAGE_SHIFT)+PAGE_OFFSET;
+
+ if ((addr >= (unsigned long) &_text) &&
+ (addr < (unsigned long) &_edata)) {
+ if (addr < (unsigned long) &_etext)
+ (*codepages)++;
+ else
+ (*datapages)++;
+ } else if ((addr >= (unsigned long) &__init_begin) &&
+ (addr < (unsigned long) &__init_end))
+ (*initpages)++;
+ else
+ (*reservedpages)++;
}
}
total += count;
\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.070 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site