kanoj-mm10-2.2.10 Clean up shm code
Subsystems (2)
PATCH 1/1 kanoj-mm10-2.2.10 Clean up shm code
This patch cleans up the unneeded SHM_ID_MASK, SHM_SWP_TYPE, SHM_IDX_MASK and SHM_IDX_SHIFT.
Thanks.
Kanoj
[email protected]
asm-alpha/shmparam.h renamed from usr/tmp/p_rdiff_a007kK/shmparam.h +0 -20
@@ -9,32 +9,12 @@/* -* Format of a swap-entry for shared memory pages currently out in -* swap space (see also mm/swap.c). -* -* SWP_TYPE = SHM_SWP_TYPE -* SWP_OFFSET is used as follows: -* -* bits 0..6 : id of shared memory segment page belongs to (SHM_ID) -* bits 7..21: index of page within shared memory segment (SHM_IDX) -* (actually fewer bits get used since SHMMAX is so low) -*/ - -/* * Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and * there is a static array of size SHMMNI. */ #define _SHM_ID_BITS 7 -#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) -#define SHM_IDX_SHIFT (_SHM_ID_BITS)#define _SHM_IDX_BITS 15 -#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) - -/* -* _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the Alpha and -* SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). -*/ #define SHMMAX 0x3fa000/* max shared seg size (bytes) */ #define SHMMIN 1/* really PAGE_SIZE */ /* min shared seg size (bytes) */
asm-arm/shmparam.h renamed from usr/tmp/p_rdiff_a007br/shmparam.h +0 -20
@@ -10,32 +10,12 @@#include <asm/proc/shmparam.h> /* -* Format of a swap-entry for shared memory pages currently out in -* swap space (see also mm/swap.c). -* -* SWP_TYPE = SHM_SWP_TYPE -* SWP_OFFSET is used as follows: -* -* bits 0..6 : id of shared memory segment page belongs to (SHM_ID) -* bits 7..21: index of page within shared memory segment (SHM_IDX) -* (actually fewer bits get used since SHMMAX is so low) -*/ - -/* * Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and * there is a static array of size SHMMNI. */ #define _SHM_ID_BITS 7 -#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) -#define SHM_IDX_SHIFT (_SHM_ID_BITS)#define _SHM_IDX_BITS 15 -#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) - -/* -* _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and -* SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). -*/ #define SHMMIN 1/* really PAGE_SIZE */ /* min shared seg size (bytes) */ #define SHMMNI (1<<_SHM_ID_BITS)/* max num of segs system wide */
asm-i386/shmparam.h renamed from usr/tmp/p_rdiff_a007eU/shmparam.h +0 -20
@@ -6,32 +6,12 @@#define SHM_RANGE_END 0x60000000/* -* Format of a swap-entry for shared memory pages currently out in -* swap space (see also mm/swap.c). -* -* SWP_TYPE = SHM_SWP_TYPE -* SWP_OFFSET is used as follows: -* -* bits 0..6 : id of shared memory segment page belongs to (SHM_ID) -* bits 7..21: index of page within shared memory segment (SHM_IDX) -* (actually fewer bits get used since SHMMAX is so low) -*/ - -/* * Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and * there is a static array of size SHMMNI. */ #define _SHM_ID_BITS 7 -#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) -#define SHM_IDX_SHIFT (_SHM_ID_BITS)#define _SHM_IDX_BITS 15 -#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) - -/* -* _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and -* SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). -*/ #define SHMMAX 0x2000000/* max shared seg size (bytes) */ /* Try not to change the default shipped SHMMAX - people rely on it */
asm-m68k/shm.h renamed from usr/tmp/p_rdiff_a007do/shm.h +0 -14
@@ -1,24 +1,10 @@#ifndef _M68K_SHM_H#define _M68K_SHM_H -/* format of page table entries that correspond to shared memory pages -currently out in swap space (see also mm/swap.c): -bits 0-1 (PAGE_PRESENT) is = 0 -bits 8..2 (SWP_TYPE) are = SHM_SWP_TYPE -bits 31..9 are used like this: -bits 15..9 (SHM_ID) the id of the shared memory segment -bits 30..16 (SHM_IDX) the index of the page within the shared memory segment -(actually only bits 25..16 get used since SHMMAX is so low) -bit 31 (SHM_READ_ONLY) flag whether the page belongs to a read-only attach -*/ /* on the m68k both bits 0 and 1 must be zero */ -#define SHM_ID_SHIFT 9#define _SHM_ID_BITS 7 -#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) -#define SHM_IDX_SHIFT (SHM_ID_SHIFT+_SHM_ID_BITS)#define _SHM_IDX_BITS 15 -#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1)#endif /* _M68K_SHM_H */
asm-m68k/shmparam.h renamed from usr/tmp/p_rdiff_a007hK/shmparam.h +0 -20
@@ -6,32 +6,12 @@#define SHM_RANGE_END 0xD0000000/* -* Format of a swap-entry for shared memory pages currently out in -* swap space (see also mm/swap.c). -* -* SWP_TYPE = SHM_SWP_TYPE -* SWP_OFFSET is used as follows: -* -* bits 0..6 : id of shared memory segment page belongs to (SHM_ID) -* bits 7..21: index of page within shared memory segment (SHM_IDX) -* (actually fewer bits get used since SHMMAX is so low) -*/ - -/* * Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and * there is a static array of size SHMMNI. */ #define _SHM_ID_BITS 7 -#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) -#define SHM_IDX_SHIFT (_SHM_ID_BITS)#define _SHM_IDX_BITS 15 -#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) - -/* -* _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and -* SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). -*/ #define SHMMAX 0x1000000/* max shared seg size (bytes) */ #define SHMMIN 1/* really PAGE_SIZE */ /* min shared seg size (bytes) */
asm-mips/shmparam.h renamed from usr/tmp/p_rdiff_a007iv/shmparam.h +0 -20
@@ -6,32 +6,12 @@#define SHM_RANGE_END 0x60000000/* -* Format of a swap-entry for shared memory pages currently out in -* swap space (see also mm/swap.c). -* -* SWP_TYPE = SHM_SWP_TYPE -* SWP_OFFSET is used as follows: -* -* bits 0..6 : id of shared memory segment page belongs to (SHM_ID) -* bits 7..21: index of page within shared memory segment (SHM_IDX) -* (actually fewer bits get used since SHMMAX is so low) -*/ - -/* * Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and * there is a static array of size SHMMNI. */ #define _SHM_ID_BITS 7 -#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) -#define SHM_IDX_SHIFT (_SHM_ID_BITS)#define _SHM_IDX_BITS 15 -#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) - -/* -* _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and -* SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). -*/ #define SHMMAX 0x1000000/* max shared seg size (bytes) */ #define SHMMIN 1/* really PAGE_SIZE */ /* min shared seg size (bytes) */
asm-ppc/shmparam.h renamed from usr/tmp/p_rdiff_a007LM/shmparam.h +0 -20
@@ -6,32 +6,12 @@#define SHM_RANGE_END 0x60000000/* -* Format of a swap-entry for shared memory pages currently out in -* swap space (see also mm/swap.c). -* -* SWP_TYPE = SHM_SWP_TYPE -* SWP_OFFSET is used as follows: -* -* bits 0..6 : id of shared memory segment page belongs to (SHM_ID) -* bits 7..21: index of page within shared memory segment (SHM_IDX) -* (actually fewer bits get used since SHMMAX is so low) -*/ - -/* * Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and * there is a static array of size SHMMNI. */ #define _SHM_ID_BITS 7 -#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) -#define SHM_IDX_SHIFT (_SHM_ID_BITS)#define _SHM_IDX_BITS 15 -#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) - -/* -* _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and -* SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). -*/ #define SHMMAX 0x3fa000/* max shared seg size (bytes) */ #define SHMMIN 1/* really PAGE_SIZE */ /* min shared seg size (bytes) */
asm-sparc/shmparam.h renamed from usr/tmp/p_rdiff_a007hj/shmparam.h +0 -20
@@ -7,32 +7,12 @@#define SHM_RANGE_END 0x20000000/* -* Format of a swap-entry for shared memory pages currently out in -* swap space (see also mm/swap.c). -* -* SWP_TYPE = SHM_SWP_TYPE -* SWP_OFFSET is used as follows: -* -* bits 0..6 : id of shared memory segment page belongs to (SHM_ID) -* bits 7..21: index of page within shared memory segment (SHM_IDX) -* (actually fewer bits get used since SHMMAX is so low) -*/ - -/* * Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and * there is a static array of size SHMMNI. */ #define _SHM_ID_BITS 7 -#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) -#define SHM_IDX_SHIFT (_SHM_ID_BITS)#define _SHM_IDX_BITS 15 -#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) - -/* -* _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and -* SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). -*/ #define SHMMAX 0x1000000/* max shared seg size (bytes) */ #define SHMMIN 1/* really PAGE_SIZE */ /* min shared seg size (bytes) */
asm-sparc64/shmparam.h renamed from usr/tmp/p_rdiff_a007aU/shmparam.h +0 -20
@@ -9,32 +9,12 @@#define SHM_RANGE_END 0x20000000/* -* Format of a swap-entry for shared memory pages currently out in -* swap space (see also mm/swap.c). -* -* SWP_TYPE = SHM_SWP_TYPE -* SWP_OFFSET is used as follows: -* -* bits 0..6 : id of shared memory segment page belongs to (SHM_ID) -* bits 7..21: index of page within shared memory segment (SHM_IDX) -* (actually fewer bits get used since SHMMAX is so low) -*/ - -/* * Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and * there is a static array of size SHMMNI. */ #define _SHM_ID_BITS 7 -#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) -#define SHM_IDX_SHIFT (_SHM_ID_BITS)#define _SHM_IDX_BITS 15 -#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) - -/* -* _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and -* SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). -*/ #define SHMMAX 0x1000000/* max shared seg size (bytes) */ #define SHMMIN 1/* really PAGE_SIZE */ /* min shared seg size (bytes) */
linux/swap.h renamed from usr/tmp/p_rdiff_a007lP/swap.h +0 -7
@@ -125,13 +125,6 @@ asmlinkage int sys_swapon(const char *, int);/* -* vm_ops not present page codes for shared memory. -* -* Will go away eventually.. -*/ -#define SHM_SWP_TYPE 0x20 - -/* * swap cache stuff (in linux/mm/swap_state.c) */
shm.c renamed from usr/tmp/p_rdiff_a007bJ/shm.c +4 -4
@@ -495,7 +495,7 @@ goto out; } - shmd->vm_pte =SWP_ENTRY (SHM_SWP_TYPE , id); + shmd->vm_pte = id; shmd->vm_start = addr; shmd->vm_end = addr + shp->shm_npages *PAGE_SIZE ; shmd->vm_mm = current->mm;
@@ -534,7 +534,7 @@unsigned int id;struct shmid_kernel *shp; - id =SWP_OFFSET (shmd->vm_pte) &SHM_ID_MASK ; + id = shmd->vm_pte; shp = shm_segs[id];if (shp ==IPC_UNUSED ) {printk ("shm_open: unused id=%d PANIC\n" , id);
@@ -558,7 +558,7 @@int id;/* remove from the list of attaches of the shm segment */ - id =SWP_OFFSET (shmd->vm_pte) &SHM_ID_MASK ; + id = shmd->vm_pte; shp = shm_segs[id];remove_attach (shp,shmd);/* remove from shp->attaches */ shp->u.shm_lpid = current->pid;
@@ -610,7 +610,7 @@struct shmid_kernel *shp;unsigned int id, idx; - id =SWP_OFFSET (shmd->vm_pte) &SHM_ID_MASK ; + id = shmd->vm_pte; idx = (address - shmd->vm_start + shmd->vm_offset) >>PAGE_SHIFT ;#ifdef DEBUG_SHM
swap_state.c renamed from usr/tmp/p_rdiff_a007lU/swap_state.c +0 -4
@@ -85,8 +85,6 @@if (!entry) goto out; type =SWP_TYPE (entry); -if (type &SHM_SWP_TYPE ) - goto out;if (type >= nr_swapfiles) goto bad_file; p = type + swap_info;
@@ -140,8 +138,6 @@if (!entry) goto bad_entry; type =SWP_TYPE (entry); -if (type &SHM_SWP_TYPE ) - goto out;if (type >= nr_swapfiles) goto bad_file; p = type + swap_info;
swapfile.c renamed from usr/tmp/p_rdiff_a007k3/swapfile.c +0 -2
@@ -119,8 +119,6 @@ goto out; type =SWP_TYPE (entry); -if (type &SHM_SWP_TYPE ) - goto out;if (type >= nr_swapfiles) goto bad_nofile; p = & swap_info[type];
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/