diff -uNr 4-1-ac7/Documentation/Changes c1-7/Documentation/Changes --- 4-1-ac7/Documentation/Changes Wed May 31 20:29:23 2000 +++ c1-7/Documentation/Changes Wed May 31 20:32:00 2000 @@ -72,6 +72,17 @@ General Information =================== + To use System V shared memory is now implemented via a filesystem. +You do not have to be mount it as long as you can live with the +defaults for the total maximum of shared memory and segments. If you +want to change these parameters you have to mount it with the options +nr_blocks and/or nr_inodes. Also mount it to /dev/shm if you want to +use posix shm. I recommend to add the following line to /etc/fstab: + +none /dev/shm shm defaults 0 0 + +Remember to create the mountpoint directory; it does not have to be /dev/shm. + now performs a cold reboot instead of a warm reboot for increased hardware compatibility. If you want a warm reboot and know it works on your hardware, add a "reboot=warm" command line option diff -uNr 4-1-ac7/Documentation/Configure.help c1-7/Documentation/Configure.help --- 4-1-ac7/Documentation/Configure.help Wed May 31 20:29:23 2000 +++ c1-7/Documentation/Configure.help Wed May 31 20:30:48 2000 @@ -2581,11 +2581,10 @@ http://www.linuxdoc.org/docs.html#guide . Shared memory is now implemented using a new (minimal) virtual file - system, which you need to mount before programs can use shared - memory. To do this automatically at system startup just add the + system. To mount it automatically at system startup just add the following line to your /etc/fstab: - none /var/shm shm defaults 0 0 + none /dev/shm shm defaults 0 0 Saying Y here enlarges your kernel by about 18 KB. Just say Y. diff -uNr 4-1-ac7/include/asm-s390/pgtable.h c1-7/include/asm-s390/pgtable.h --- 4-1-ac7/include/asm-s390/pgtable.h Mon May 22 15:02:03 2000 +++ c1-7/include/asm-s390/pgtable.h Wed May 31 20:38:47 2000 @@ -270,6 +270,7 @@ extern inline int pte_none(pte_t pte) { return ((pte_val(pte) & (_PAGE_INVALID | _PAGE_RO)) == _PAGE_INVALID); } extern inline int pte_present(pte_t pte) { return pte_val(pte) & _PAGE_PRESENT; } extern inline void pte_clear(pte_t *ptep) { pte_val(*ptep) = _PAGE_INVALID; } +#define PTE_INIT(x) pte_clear(x) extern inline int pte_pagenr(pte_t pte) { return ((unsigned long)((pte_val(pte) >> PAGE_SHIFT))); } extern inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PAGE_TABLE_INV; } diff -uNr 4-1-ac7/ipc/shm.c c1-7/ipc/shm.c --- 4-1-ac7/ipc/shm.c Wed May 24 09:10:57 2000 +++ c1-7/ipc/shm.c Wed May 31 20:50:59 2000 @@ -16,11 +16,9 @@ * * The filesystem has the following restrictions/bugs: * 1) It only can handle one directory. - * 2) Because the directory is represented by the SYSV shm array it - * can only be mounted one time. - * 3) Private writeable mappings are not supported - * 4) Read and write are not implemented (should they?) - * 5) No special nodes are supported + * 2) Private writeable mappings are not supported + * 3) Read and write are not implemented (should they?) + * 4) No special nodes are supported * * There are the following mount options: * - nr_blocks (^= shmall) is the number of blocks of size PAGE_SIZE @@ -335,7 +333,7 @@ return (struct shmid_kernel *)ipc_rmid(&shm_ids,id); } -static __inline__ int shm_addid(struct shmid_kernel *shp) +static inline int shm_addid(struct shmid_kernel *shp) { return ipc_addid(&shm_ids, &shp->shm_perm, shm_ctlmni+1); } @@ -544,12 +542,36 @@ return 0; } -#define SHM_ENTRY(shp, index) (shp)->shm_dir[(index)/PTRS_PER_PTE][(index)%PTRS_PER_PTE] +/* + * We cannot use kmalloc for shm_alloc since this restricts the + * maximum size of the segments. + * + * We also cannot use vmalloc, since this uses too much of the vmalloc + * space and we run out of this on highend machines. + * + * So we have to use this complicated indirect scheme to alloc the shm + * page tables. + * + */ + +#ifdef PTE_INIT +static inline void init_ptes (pte_t *pte, int number) { + while (number--) + PTE_INIT (pte++); +} +#else +static inline void init_ptes (pte_t *pte, int number) { + memset (pte, 0, number*sizeof(*pte)); +} +#endif + +#define PTES_PER_PAGE (PAGE_SIZE/sizeof(pte_t)) +#define SHM_ENTRY(shp, index) (shp)->shm_dir[(index)/PTES_PER_PAGE][(index)%PTES_PER_PAGE] static pte_t **shm_alloc(unsigned long pages, int doacc) { - unsigned short dir = pages / PTRS_PER_PTE; - unsigned short last = pages % PTRS_PER_PTE; + unsigned short dir = pages / PTES_PER_PAGE; + unsigned short last = pages % PTES_PER_PAGE; pte_t **ret, **ptr, *pte; if (pages == 0) @@ -564,7 +586,7 @@ *ptr = (pte_t *)__get_free_page (GFP_KERNEL); if (!*ptr) goto free; - for (pte = *ptr; pte < *ptr + PTRS_PER_PTE; pte++) + for (pte = *ptr; pte < *ptr + PTES_PER_PAGE; pte++) pte_clear (pte); } @@ -573,8 +595,7 @@ *ptr = kmalloc (last*sizeof(pte_t), GFP_KERNEL); if (!*ptr) goto free; - for (pte = *ptr; pte < *ptr + last; pte++) - pte_clear (pte); + init_ptes (*ptr, PTES_PER_PAGE); } if (doacc) { shm_lockall(); @@ -597,14 +618,14 @@ static void shm_free(pte_t** dir, unsigned long pages, int doacc) { int i, rss, swp; - pte_t **ptr = dir+pages/PTRS_PER_PTE; + pte_t **ptr = dir+pages/PTES_PER_PAGE; if (!dir) return; for (i = 0, rss = 0, swp = 0; i < pages ; i++) { pte_t pte; - pte = dir[i/PTRS_PER_PTE][i%PTRS_PER_PTE]; + pte = dir[i/PTES_PER_PAGE][i%PTES_PER_PAGE]; if (pte_none(pte)) continue; if (pte_present(pte)) { @@ -617,7 +638,7 @@ } /* first the last page */ - if (pages%PTRS_PER_PTE) + if (pages%PTES_PER_PAGE) kfree (*ptr); /* now the whole pages */ while (--ptr >= dir) @@ -674,8 +695,8 @@ pte_t *swap; int i,j; i = old_pages < new_pages ? old_pages : new_pages; - j = i % PTRS_PER_PTE; - i /= PTRS_PER_PTE; + j = i % PTES_PER_PAGE; + i /= PTES_PER_PAGE; if (j) memcpy (new_dir[i], old_dir[i], j * sizeof (pte_t)); while (i--) { @@ -1492,7 +1513,7 @@ shm_lockall(); check_id: shp = shm_get(swap_id); - if(shp==NULL || shp->shm_flags & SHM_LOCKED) { + if(shp==NULL || shp->shm_flags & PRV_LOCKED) { next_id: swap_idx = 0; if (++swap_id > shm_ids.max_id) { diff -uNr 4-1-ac7/ipc/util.c c1-7/ipc/util.c --- 4-1-ac7/ipc/util.c Wed May 24 09:10:57 2000 +++ c1-7/ipc/util.c Wed May 31 20:30:48 2000 @@ -310,7 +310,7 @@ int map_zero_setup(struct vm_area_struct *vma) { - return -EINVAL; + return -ENOSYS; } #endif /* CONFIG_SYSVIPC */