|
From: Andy P. <at...@us...> - 2002-04-09 12:33:35
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm
In directory usw-pr-cvs1:/tmp/cvs-serv9454/asm-vax/mm
Modified Files:
pagelet.h pagelet_pgd.h pagelet_pmd.h pagelet_pte.h pgalloc.h
pgtable.h task.h
Log Message:
Synch to 2.4.15 commit 1
Index: pagelet.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pagelet.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- pagelet.h 31 Jul 2001 17:33:26 -0000 1.3
+++ pagelet.h 9 Apr 2002 12:33:20 -0000 1.4
@@ -5,7 +5,9 @@
* the upper layers idea of the PAGE_SIZE (4k) and the Hardware's
* idea of PAGE_SIZE (512bytes).
*
- * Copyright atp 1998-2001. Integrated with 2.4 tree Jan 2001
+ * Copyright atp 1998-2002.
+ * Jan 2001 atp Integrated with 2.4 tree
+ * Mar 2002 atp Updates to deal with pmd_populate/pgd_populate in 2.4.3
*/
@@ -69,26 +71,35 @@
* as a pseudo pgd.
* note, the length register here is 1/8th of the real (processor)
* length register
+ *
+ * IMPORTANT NOTE
+ * --------------
+ * if you change this structure, you will need to recalculate
+ * the offsets in asm/mm/pgtable.h which are used in
+ * arch/vax/boot/head.S (ASM_SBR_OFFSET and ASM_SLR_OFFSET)
*/
-struct vax_pgd_descriptor {
+
+/* definition of pmd_t - needed for pgd_t */
+typedef struct {
+ unsigned long pmd;
+} pmd_t;
+
+
+struct pgd_descriptor {
unsigned long br;
unsigned long lr;
- unsigned long pmd; /* first four pages of the task PTE slot are the pmds
- * There are two pmd's one for p0 and one for p1 */
- unsigned long pmd2; /* This is just a place holder, as we pretend that
- * our pmds hold 2048 entries and are 2 pages long */
+ pmd_t *pmd; /* first four pages of the task PTE slot are the pmds
+ * Our pmds hold 2048 entries and are 2 pages long */
unsigned long slot; /* the base address of this slot */
unsigned long segment; /* The segment index - used in pgd_clear */
};
/* pgd_t definitions */
-typedef struct vax_pgd_descriptor pgd_t;
+typedef struct pgd_descriptor pgd_t;
/* the .pmd is not a typo */
#define pgd_val(x) ((x).pmd)
#define __pgd(x) ((pgd_t) { (x) } )
-/* definition of pmd_t */
-typedef struct { unsigned long pmd; } pmd_t;
#define pmd_val(x) ((x).pmd)
#define __pmd(x) ((pmd_t) { (x) } )
Index: pagelet_pgd.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pagelet_pgd.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pagelet_pgd.h 31 Jul 2001 17:33:26 -0000 1.2
+++ pagelet_pgd.h 9 Apr 2002 12:33:20 -0000 1.3
@@ -45,9 +45,9 @@
* into the pgd entry)
* All the actual stuff is done by the pmd_xxx functions
*/
-extern inline int pgd_none(pgd_t pgd) { return !(pgd).pmd; }
-extern inline int pgd_bad(pgd_t pgd) { return !(pgd).br; }
-extern inline int pgd_present(pgd_t pgd) { return ((pgd).pmd != 0); }
+static inline int pgd_none(pgd_t pgd) { return !(pgd).pmd; }
+static inline int pgd_bad(pgd_t pgd) { return !(pgd).br; }
+static inline int pgd_present(pgd_t pgd) { return ((pgd).pmd != 0); }
extern void pgd_clear(pgd_t * pgdp);
Index: pagelet_pmd.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pagelet_pmd.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- pagelet_pmd.h 31 Jul 2001 17:33:26 -0000 1.3
+++ pagelet_pmd.h 9 Apr 2002 12:33:20 -0000 1.4
@@ -5,6 +5,7 @@
*
* Copyright atp Jan 2001.
* atp Jul 2001. Go to a fake 3 level.
+ * atp Feb 2002. Add in pmd_populate needed for 2.4.3 changes to mm.
*/
@@ -34,30 +35,33 @@
/*
* we dont want linux mucking about with our pmd pages. It will get it
* wrong. pmd_alloc and pmd_free do the business there.
+ *
+ * Changes for 2.4.3 and above. pmd_alloc is no more. we have pgd
+ * and pmd_populate now.
+ * -- Change to a pmd that is a two page block of memeory.
+ * -- remove special flag.
*/
#define set_pmd(pmdptr, pmdval)
-/* Fixme:, check the length as well as the base register. */
-extern inline int pmd_none(pmd_t pmd)
+static inline int pmd_none(pmd_t pmd)
{
- if (pmd_val(pmd) & 0x1) return 1;
return (pmd_val(pmd) == 0);
}
-extern inline int pmd_bad(pmd_t pmd) { return (pmd_val(pmd) == 0); }
-extern inline int pmd_present(pmd_t pmd) { return (pmd_val(pmd) != 0); }
+static inline int pmd_bad(pmd_t pmd) { return (pmd_val(pmd) == 0); }
+static inline int pmd_present(pmd_t pmd) { return (pmd_val(pmd) != 0); }
/* clear the pmd entry */
-extern inline void pmd_clear(pmd_t * pmdp) { pmd_val(*pmdp) = 0; }
+static inline void pmd_clear(pmd_t * pmdp) { pmd_val(*pmdp) = 0; }
/* Find an entry in the second-level page table.. */
#define pmd_index(address) ((address >> PMD_SHIFT) & (PTRS_PER_PMD-1))
-extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
+static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
{
+ /* locate the pmd entry according to address */
pmd_t *ptr;
ptr = (pmd_t *)pmd_val(*dir) + pmd_index(address);
- /* locate the pmd entry according to address */
// printk("pmd_offset: pgd %8p, pmd_val %8lx, address %8lx, index %8lx, offset %8p\n",dir,pmd_val(*dir),address,pmd_index(address),ptr);
return ptr;
}
Index: pagelet_pte.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pagelet_pte.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- pagelet_pte.h 31 Aug 2001 11:53:29 -0000 1.7
+++ pagelet_pte.h 9 Apr 2002 12:33:20 -0000 1.8
@@ -141,8 +141,6 @@
#define pte_page(x) (mem_map+(unsigned long)(((pte_val(x) & PAGE_PFN_MASK) \
>> (PAGE_SHIFT - PAGELET_SHIFT))))
-
-
/*
* This requires that pte_set is called after pte_modify
* -- There is (7/2/2001) one reference to this in mm/mprotect.c
Index: pgalloc.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pgalloc.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- pgalloc.h 2 Sep 2001 20:52:51 -0000 1.13
+++ pgalloc.h 9 Apr 2002 12:33:20 -0000 1.14
@@ -1,7 +1,7 @@
#ifndef __ASM_VAX_MM_PGALLOC_H
#define __ASM_VAX_MM_PGALLOC_H
-/* Copyright atp 1998-2001. pgalloc.h for VAX architecture. */
+/* Copyright atp 1998-2002. pgalloc.h for VAX architecture. */
/*
* Fixmes:
* 1) the pte_alloc/freeing stuff. Check Constraints here
@@ -20,6 +20,7 @@
* atp Jun 2001 remove fixed size processes, use 3 level page table and pte slots.
* atp Jun-Jul 2001 - complete rewrite.
* atp Aug 2001 - swapping and vmalloc need pmd_alloc_kernel
+ * atp Feb 2002 - Update to track mm changes in 2.4.x (x>2)
*
* each 'pgd' spans an address range of 0x40000000 bytes.
* each page of 'ptes' spans an address range of 0x80000 bytes
@@ -33,21 +34,24 @@
#ifndef CONFIG_SMP
extern struct pgtable_cache_struct {
- unsigned long *pgd_cache;
+ unsigned long *pgd_cache; /* These are special recyclable slots */
unsigned long pgd_slots_used;
unsigned long pgd_cache_sz;
- unsigned long *pte_cache;
+ unsigned long *pmd_cache; /* These are two page blocks */
+ unsigned long pmd_cache_sz;
+ unsigned long *pte_cache; /* These are one page blocks */
unsigned long pgtable_cache_sz;
} quicklists;
#else
#include <asm/smp.h>
-#define quicklists cpu_data[smp_processor_id()]
-
+//#define quicklists cpu_data[smp_processor_id()]
+#error SMP not supported
#endif
#define pgd_quicklist (quicklists.pgd_cache)
-#define pmd_quicklist ((unsigned long *)0)
+#define pmd_quicklist (quicklists.pmd_cache)
#define pte_quicklist (quicklists.pte_cache)
+#define pmd_cache_size (quicklists.pmd_cache_sz)
#define pgtable_cache_size (quicklists.pgtable_cache_sz)
#define pgd_cache_size (quicklists.pgd_cache_sz)
#define pgd_slots_used (quicklists.pgd_slots_used)
@@ -58,64 +62,72 @@
* if any.
*/
-extern pgd_t *pgd_alloc(void);
-extern pgd_t *get_pgd_fast(void);
-extern __inline__ void free_pgd_fast(pgd_t *pgd)
+static inline void free_pgd_fast(pgd_t *pgd)
{
*(unsigned long *)pgd = (unsigned long) pgd_quicklist;
pgd_quicklist = (unsigned long *) pgd;
pgd_cache_size++;
}
-extern __inline__ void free_pgd_slow(pgd_t *pgd)
+static inline void free_pgd_slow(pgd_t *pgd)
{
- /* we dont do this at present */
-}
+ /*
+ * atp Mar 2002.
+ * We never free pgd 'pages'. The cache structure maintains
+ * a free list of free pgd/memory map slots, in the user page
+ * tables. This is contiguous in S0 page space
+ * If we need a pgd, we pick a 'slot' which holds all the pmds
+ * and ptes in a contiguous block of system address space.
+ */
-extern pmd_t *get_pmd_slow(void);
+}
-/* Page Mid level directory handling routines. */
-static inline pmd_t *get_pmd_fast(void)
+/* renamed from get_pmd_slow to pmd_alloc_one, mar 2002 */
+/* FIXME: This can be statically inlined -> pgalloc.h */
+static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
+{
+ pmd_t *ret;
+ ret = (pmd_t *)__get_free_pages(GFP_KERNEL,1);
+ if (ret) {
+ clear_page(ret);
+ clear_page(ret + (PAGE_SIZE/sizeof(pmd_t)));
+ }
+ return ret;
+}
+
+/* Page Mid level directory handling routines.
+ * renamed from get_pmd_fast */
+static inline pmd_t *pmd_alloc_one_fast(struct mm_struct *mm, unsigned long address)
{
unsigned long *ret;
- if ((ret = (unsigned long *)pte_quicklist) != NULL) {
- pte_quicklist = (unsigned long *)(*ret);
+ if ((ret = (unsigned long *)pmd_quicklist) != NULL) {
+ pmd_quicklist = (unsigned long *)(*ret);
ret[0] = 0;
- pgtable_cache_size--;
+ pmd_cache_size--;
}
return (pmd_t *)ret;
}
static inline void free_pmd_fast(pmd_t *pmd)
{
- *(unsigned long *)pmd = (unsigned long) pte_quicklist;
- pte_quicklist = (unsigned long *) pmd;
- pgtable_cache_size++;
+ *(unsigned long *)pmd = (unsigned long) pmd_quicklist;
+ pmd_quicklist = (unsigned long *) pmd;
+ pmd_cache_size++;
}
static inline void free_pmd_slow(pmd_t *pmd)
{
- free_page((unsigned long)pmd);
+ /*
+ * a pmd is a *two* page block of memory, allocated with
+ * __get_free_pages(GFP_KERNEL, 1);
+ */
+ free_pages(((unsigned long)pmd),1);
}
-/* in arch/vax/mm/pgalloc.c */
-extern pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address);
-extern void pmd_free(pmd_t *pmd);
-extern pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address);
-extern void pmd_free_kernel(pmd_t *pmd);
-extern void pte_free(pte_t *pte);
-extern pte_t *get_pageaddr_from_pte(pte_t *ptep);
-extern void free_pte_slow(pte_t *pte);
-
-extern pte_t *get_pte_slow(void);
-extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long offset);
-extern void remap_and_clear_pte_page(pmd_t *s0addr, pte_t *page);
-extern void remap_pte_invalidate(pmd_t *s0addr);
-extern void pte_free_kernel(pte_t *pte);
-
-extern __inline__ pte_t *get_pte_fast(void)
+/* renamed from get_pte_fast, mar 2002 */
+static inline pte_t *pte_alloc_one_fast(struct mm_struct *mm, unsigned long address)
{
unsigned long *ret;
@@ -127,24 +139,47 @@
return (pte_t *)ret;
}
-extern __inline__ void free_pte_fast(pte_t *pte)
+/* renamed from get_pte_slow mar 2002 */
+static inline pte_t *pte_alloc_one(struct mm_struct *mm, unsigned long address)
+{
+ unsigned long pte;
+
+ pte = (unsigned long) __get_free_page(GFP_KERNEL);
+ if (pte) {
+ return (pte_t *) pte;
+ }
+ return NULL;
+}
+
+static inline void free_pte_fast(pte_t *pte)
{
*(unsigned long *)pte = (unsigned long) pte_quicklist;
pte_quicklist = (unsigned long *) pte;
pgtable_cache_size++;
}
-extern __inline__ void page_clear(pte_t *pte) {memset(pte, 0, PAGE_SIZE);}
-#define pgd_free(pgd) free_pgd_fast(pgd)
+/* in arch/vax/mm/pgalloc.c */
+extern pgd_t *pgd_alloc(struct mm_struct *mm);
+extern pgd_t *get_pgd_fast(void);
+extern void pmd_free(pmd_t *pmd);
+extern void pte_free(pte_t *pte);
+extern pte_t *get_pageaddr_from_pte(pte_t *ptep);
+extern void free_pte_slow(pte_t *pte);
+extern void remap_and_clear_pte_page(pmd_t *s0addr, pte_t *page);
+extern void remap_pte_invalidate(pmd_t *s0addr);
+extern void pte_free_kernel(pte_t *pte);
+extern pte_t * vax_pte_alloc_one(pmd_t *pmd);
+extern void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd);
+extern void pmd_populate(struct mm_struct *mm, pmd_t * pmd, pte_t *pte);
+extern void pmd_populate_S0(pgd_t *pgd, pmd_t *pmd);
-/* atp jun 01, moved these to arch/vax/mm/pgalloc.c */
-/* Allocate a new page for a page table for the kernel */
-extern pte_t *pte_alloc_kernel(pmd_t *pmd, unsigned long address);
-extern pte_t *pte_alloc(pmd_t *pmd, unsigned long address);
-extern pte_t * pte_alloc_one(pmd_t *pmd);
+/* in arch/vax/mm/init.c */
extern int do_check_pgt_cache(int, int);
+
+#define pgd_free(pgd) free_pgd_fast(pgd)
+
/* tlb routines */
Index: pgtable.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pgtable.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- pgtable.h 11 Sep 2001 19:29:35 -0000 1.15
+++ pgtable.h 9 Apr 2002 12:33:20 -0000 1.16
@@ -59,6 +59,14 @@
/* SPT_SIZE is the size in BYTES */
#define SPT_SIZE ((unsigned long)( (swapper_pg_dir[2]).lr ) << 2)
+/* Offsets for the system page table for the asm code in head.S
+ * if you alter pgd_t change these.
+ */
+/* swapper_pg_dir[2].br */
+#define ASM_SBR_OFFSET 40
+/* swapper_pg_dir[2].lr */
+#define ASM_SLR_OFFSET 44
+
/*
* Macros to get page table addresses + offsets.
*
Index: task.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/task.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- task.h 11 Sep 2001 19:29:35 -0000 1.6
+++ task.h 9 Apr 2002 12:33:21 -0000 1.7
@@ -4,6 +4,19 @@
/* atp July 2001. */
/* These are all used to size the relevant structures in the system
* page table, in paging_init (arch/vax/mm/init.c)
+ *
+ * reminder: The vax memory map is not sparse. Every hole in the address
+ * space uses page table entries, and wastes memory. In addition
+ * Because the page tables need to be contiguous, in S0 virtual
+ * memory, we have to allocate contiguous system page table entries,
+ * which, in turn have to be contiguous in physical ram. So we fix
+ * at boot the amount of Virtual Address space that each task has
+ * available, and the maximum number of tasks that can be run.
+ * Keep these values as small as you can, or you will waste lots
+ * of memory on useless pagetables. Documentation/vax/memory.txt.
+ *
+ * Mar 2002. Update to 2.4.3 memory management. Thought of a better way
+ * of workig back to the pgd. Removed PGD_SPECIAL botch.
*/
/* currently allocate 32mb of virtual memory */
@@ -13,8 +26,11 @@
* get wierd here */
/* TASK_WSMAX is the max virtual address space in P0 */
-/* TASK_WSMAX must not be larger than 768MB. In the unlikely event that
- * you really want to allocate that much to a process, change PGD_SPECIAL below */
+/* TASK_WSMAX must not be larger than 1Gb, it is the sum of the
+ * TXT section - which defines the largest program that can be run,
+ * and the MMAP section, which describes how much virtual address space
+ * that program has available to it
+ */
/* TASK_TXTMAX is the maximum program size */
#define TASK_TXTMAX (6*1024*1024)
@@ -25,9 +41,6 @@
#define TASK_MMAPMAX (58*1024*1024)
/* TASK_STKMAX is the max space for the stack in P1 */
-/* Like WSMAX above, the upper limit for this is set by PGD_SPECIAL below. If this
- * is above 256MB change PGD_SPECIAL
- */
#define TASK_STKMAX (4*1024*1024)
#define TASK_WSMAX (TASK_TXTMAX+TASK_MMAPMAX)
@@ -70,13 +83,6 @@
#define P0PMD_OFFSET (0)
#define P1PMD_OFFSET (PAGE_SIZE*2)
-/*
- * This is a special index into the pmd. This stores a back pointer to the
- * pgd in the pmd. The default value of 1536 allows 768 MB for WSMAX and 256
- * MB for stack. If you want to change that allocation, bear in mind that you
- * have to trade WSMAX for STKMAX. Unless I think of a cleverer way of doing this.
- */
-#define PGD_SPECIAL 1536
/*
* User space process size: 2GB (default).
* This is a bit bogus - a linux thing.
|