Commit ac0f5e76 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] architecture-independand si_meminfo

Si_meminfo() is basically the same for all architectures (mips is a little
different by providing a value for the shared field that is different from
the originial intent, I will come back to this later), so it makes to have just
one instance of it:
parent bf0f0f39
......@@ -36,8 +36,6 @@
mmu_gather_t mmu_gathers[NR_CPUS];
unsigned long totalram_pages;
extern void die_if_kernel(char *,struct pt_regs *,long);
static struct pcb_struct original_pcb;
......@@ -390,15 +388,3 @@ free_initrd_mem(unsigned long start, unsigned long end)
printk ("Freeing initrd memory: %ldk freed\n", (end - __start) >> 10);
}
#endif
void
si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = 0;
val->freehigh = 0;
val->mem_unit = PAGE_SIZE;
}
......@@ -358,7 +358,6 @@ void __init mem_init(void)
extern int page_is_ram(unsigned long) __init;
extern char _text, _etext, _data, _edata;
extern char __init_begin, __init_end;
extern unsigned long totalram_pages;
unsigned long nid, i;
mem_map_t * lmem_map;
......
......@@ -48,7 +48,6 @@
#define TABLE_SIZE ((TABLE_OFFSET + PTRS_PER_PTE) * sizeof(pte_t))
static unsigned long totalram_pages;
extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
extern char _stext, _text, _etext, _end, __init_begin, __init_end;
......@@ -631,14 +630,3 @@ static int __init keepinitrd_setup(char *__unused)
__setup("keepinitrd", keepinitrd_setup);
#endif
void si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = 0;
val->freehigh = 0;
val->mem_unit = PAGE_SIZE;
}
......@@ -114,8 +114,6 @@
#include <asm/io.h>
#include <asm/mmu_context.h>
static unsigned long totalram_pages;
struct pgtable_cache_struct quicklists; /* see asm/pgalloc.h */
const char bad_pmd_string[] = "Bad pmd in pte_alloc: %08lx\n";
......@@ -471,15 +469,3 @@ free_initmem(void)
printk ("Freeing unused kernel memory: %luk freed\n",
(&__init_end - &__init_begin) >> 10);
}
void
si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = 0;
val->freehigh = 0;
val->mem_unit = PAGE_SIZE;
}
......@@ -41,8 +41,6 @@
mmu_gather_t mmu_gathers[NR_CPUS];
unsigned long highstart_pfn, highend_pfn;
static unsigned long totalram_pages;
static unsigned long totalhigh_pages;
/*
* NOTE: pagetable_init alloc all the fixmap pagetables contiguous on the
......@@ -561,18 +559,6 @@ void free_initrd_mem(unsigned long start, unsigned long end)
}
#endif
void si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = totalhigh_pages;
val->freehigh = nr_free_highpages();
val->mem_unit = PAGE_SIZE;
return;
}
#if defined(CONFIG_X86_PAE)
static struct kmem_cache_s *pae_pgd_cachep;
......
......@@ -36,8 +36,6 @@ extern void ia64_tlb_init (void);
unsigned long MAX_DMA_ADDRESS = PAGE_OFFSET + 0x100000000UL;
static unsigned long totalram_pages;
static int pgt_cache_water[2] = { 25, 50 };
void
......@@ -158,19 +156,6 @@ free_initrd_mem (unsigned long start, unsigned long end)
}
}
void
si_meminfo (struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = 0;
val->freehigh = 0;
val->mem_unit = PAGE_SIZE;
return;
}
void
show_mem(void)
{
......
......@@ -35,8 +35,6 @@
mmu_gather_t mmu_gathers[NR_CPUS];
unsigned long totalram_pages = 0;
int do_check_pgt_cache(int low, int high)
{
int freed = 0;
......@@ -202,18 +200,3 @@ void free_initrd_mem(unsigned long start, unsigned long end)
printk ("Freeing initrd memory: %dk freed\n", pages);
}
#endif
void si_meminfo(struct sysinfo *val)
{
unsigned long i;
i = max_mapnr;
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = 0;
val->freehigh = 0;
val->mem_unit = PAGE_SIZE;
return;
}
......@@ -286,7 +286,6 @@ void __init paging_init(void)
}
extern char __init_begin, __init_end;
extern unsigned long totalram_pages;
void free_initmem(void)
{
......
......@@ -45,8 +45,6 @@
mmu_gather_t mmu_gathers[NR_CPUS];
static unsigned long totalram_pages;
extern void prom_free_prom_memory(void);
......@@ -265,16 +263,3 @@ void free_initmem(void)
printk("Freeing unused kernel memory: %dk freed\n",
(&__init_end - &__init_begin) >> 10);
}
void si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = atomic_read(&shmem_nrpages);
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = 0;
val->freehigh = nr_free_highpages();
val->mem_unit = PAGE_SIZE;
return;
}
......@@ -40,8 +40,6 @@
mmu_gather_t mmu_gathers[NR_CPUS];
unsigned long totalram_pages;
void pgd_init(unsigned long page)
{
unsigned long *p, *end;
......@@ -458,17 +456,3 @@ free_initmem(void)
printk("Freeing unused kernel memory: %ldk freed\n",
(&__init_end - &__init_begin) >> 10);
}
void
si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = atomic_read(&shmem_nrpages);
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = 0;
val->freehigh = nr_free_highpages();
val->mem_unit = PAGE_SIZE;
return;
}
......@@ -265,7 +265,6 @@ void __init mem_init(void)
{
extern char _stext, _etext, _fdata, _edata;
extern char __init_begin, __init_end;
extern unsigned long totalram_pages;
extern unsigned long setup_zero_pages(void);
cnodeid_t nid;
unsigned long tmp;
......
......@@ -20,7 +20,6 @@
#include <asm/pgalloc.h>
static unsigned long totalram_pages;
extern unsigned long max_pfn, mem_max;
void free_initmem(void) {
......@@ -451,29 +450,3 @@ void free_initrd_mem(unsigned long start, unsigned long end)
#endif
}
#endif
void si_meminfo(struct sysinfo *val)
{
int i;
i = max_mapnr;
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
#if 0
while (i-- > 0) {
if (PageReserved(mem_map+i))
continue;
val->totalram++;
if (!atomic_read(&mem_map[i].count))
continue;
val->sharedram += atomic_read(&mem_map[i].count) - 1;
}
val->totalram <<= PAGE_SHIFT;
val->sharedram <<= PAGE_SHIFT;
#endif
val->totalhigh = 0;
val->freehigh = 0;
return;
}
......@@ -70,8 +70,6 @@ unsigned long ppc_memoffset = PAGE_OFFSET;
int mem_init_done;
int init_bootmem_done;
int boot_mapsize;
unsigned long totalram_pages;
unsigned long totalhigh_pages;
#ifdef CONFIG_ALL_PPC
unsigned long agp_special_page;
#endif
......@@ -145,17 +143,6 @@ void show_mem(void)
printk("%ld buffermem pages\n", nr_buffermem_pages());
}
void si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = totalhigh_pages;
val->freehigh = nr_free_highpages();
val->mem_unit = PAGE_SIZE;
}
/* Free up now-unused memory */
static void free_sec(unsigned long start, unsigned long end, const char *name)
{
......
......@@ -73,7 +73,6 @@ int mem_init_done;
unsigned long ioremap_bot = IMALLOC_BASE;
static int boot_mapsize;
static unsigned long totalram_pages;
extern pgd_t swapper_pg_dir[];
extern char __init_begin, __init_end;
......@@ -138,17 +137,6 @@ void show_mem(void)
printk("%ld buffermem pages\n", nr_buffermem_pages());
}
void si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = 0;
val->freehigh = 0;
val->mem_unit = PAGE_SIZE;
}
void *
ioremap(unsigned long addr, unsigned long size)
{
......
......@@ -39,8 +39,6 @@
mmu_gather_t mmu_gathers[NR_CPUS];
static unsigned long totalram_pages;
pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE)));
char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
......@@ -230,14 +228,3 @@ void free_initrd_mem(unsigned long start, unsigned long end)
}
}
#endif
void si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = 0;
val->freehigh = 0;
val->mem_unit = PAGE_SIZE;
}
......@@ -39,8 +39,6 @@
mmu_gather_t mmu_gathers[NR_CPUS];
static unsigned long totalram_pages;
pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE)));
char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
......@@ -243,17 +241,6 @@ void free_initrd_mem(unsigned long start, unsigned long end)
}
#endif
void si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = 0;
val->freehigh = 0;
val->mem_unit = PAGE_SIZE;
}
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
......
......@@ -48,9 +48,6 @@ pg_data_t discontig_page_data[NR_NODES];
bootmem_data_t discontig_node_bdata[NR_NODES];
#endif
static unsigned long totalram_pages;
static unsigned long totalhigh_pages;
void show_mem(void)
{
int i, total = 0, reserved = 0;
......@@ -203,15 +200,3 @@ void free_initrd_mem(unsigned long start, unsigned long end)
printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
}
#endif
void si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = totalhigh_pages;
val->freehigh = nr_free_highpages();
val->mem_unit = PAGE_SIZE;
return;
}
......@@ -63,8 +63,6 @@ extern volatile int smp_process_available;
extern volatile int smp_commenced;
extern int __smp4d_processor_id(void);
extern unsigned long totalram_pages;
/* #define SMP_DEBUG */
#ifdef SMP_DEBUG
......
......@@ -59,8 +59,6 @@ extern volatile int smp_process_available;
extern volatile int smp_commenced;
extern int __smp4m_processor_id(void);
extern unsigned long totalram_pages;
/*#define SMP_DEBUG*/
#ifdef SMP_DEBUG
......
......@@ -55,8 +55,6 @@ extern unsigned int sparc_ramdisk_image;
extern unsigned int sparc_ramdisk_size;
unsigned long highstart_pfn, highend_pfn;
unsigned long totalram_pages;
unsigned long totalhigh_pages;
pte_t *kmap_pte;
pgprot_t kmap_prot;
......@@ -505,18 +503,6 @@ void free_initrd_mem(unsigned long start, unsigned long end)
}
#endif
void si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = totalhigh_pages;
val->freehigh = nr_free_highpages();
val->mem_unit = PAGE_SIZE;
}
void flush_page_to_ram(struct page *page)
{
unsigned long vaddr = (unsigned long)page_address(page);
......
......@@ -1105,7 +1105,6 @@ static inline void map_kernel(void)
extern void sparc_context_init(int);
extern int linux_num_cpus;
extern unsigned long totalhigh_pages;
void (*poke_srmmu)(void) __initdata = NULL;
......
......@@ -1790,17 +1790,3 @@ void free_initrd_mem(unsigned long start, unsigned long end)
}
}
#endif
void si_meminfo(struct sysinfo *val)
{
val->totalram = num_physpages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
/* These are always zero on Sparc64. */
val->totalhigh = 0;
val->freehigh = 0;
val->mem_unit = PAGE_SIZE;
}
......@@ -39,8 +39,6 @@
mmu_gather_t mmu_gathers[NR_CPUS];
static unsigned long totalram_pages;
/*
* NOTE: pagetable_init alloc all the fixmap pagetables contiguous on the
* physical space so we can cache the place of the first one and move
......@@ -385,15 +383,3 @@ void free_initrd_mem(unsigned long start, unsigned long end)
}
}
#endif
void si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
val->totalhigh = 0;
val->freehigh = nr_free_highpages();
val->mem_unit = PAGE_SIZE;
return;
}
......@@ -96,6 +96,8 @@ extern int nr_swap_pages;
/* Swap 50% full? Release swapcache more aggressively.. */
#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
extern unsigned long totalram_pages;
extern unsigned long totalhigh_pages;
extern unsigned int nr_free_pages(void);
extern unsigned int nr_free_buffer_pages(void);
extern unsigned int nr_free_pagecache_pages(void);
......
......@@ -23,6 +23,8 @@
#include <linux/compiler.h>
#include <linux/module.h>
unsigned long totalram_pages;
unsigned long totalhigh_pages;
int nr_swap_pages;
int nr_active_pages;
int nr_inactive_pages;
......@@ -606,6 +608,22 @@ unsigned long get_page_cache_size(void)
return ps.nr_pagecache;
}
void si_meminfo(struct sysinfo *val)
{
val->totalram = totalram_pages;
val->sharedram = 0;
val->freeram = nr_free_pages();
val->bufferram = atomic_read(&buffermem_pages);
#ifdef CONFIG_HIGHMEM
val->totalhigh = totalhigh_pages;
val->freehigh = nr_free_highpages();
#else
val->totalhigh = 0;
val->freehigh = 0;
#endif
val->mem_unit = PAGE_SIZE;
}
#define K(x) ((x) << (PAGE_SHIFT-10))
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment