linux/mm
David Howells 930e652a21 [PATCH] NOMMU: Make futexes work under NOMMU conditions
Make futexes work under NOMMU conditions.

This can be tested by running this in one shell:

	#define SYSERROR(X, Y) \
		do { if ((long)(X) == -1L) { perror(Y); exit(1); }} while(0)

	int main()
	{
		int shmid, tmp, *f, n;

		shmid = shmget(23, 4, IPC_CREAT|0666);
		SYSERROR(shmid, "shmget");

		f = shmat(shmid, NULL, 0);
		SYSERROR(f, "shmat");

		n = *f;
		printf("WAIT: %p{%x}\n", f, n);
		tmp = futex(f, FUTEX_WAIT, n, NULL, NULL, 0);
		SYSERROR(tmp, "futex");
		printf("WAITED: %d\n", tmp);

		tmp = shmdt(f);
		SYSERROR(tmp, "shmdt");

		exit(0);
	}

And then this in the other shell:

	#define SYSERROR(X, Y) \
		do { if ((long)(X) == -1L) { perror(Y); exit(1); }} while(0)

	int main()
	{
		int shmid, tmp, *f;

		shmid = shmget(23, 4, IPC_CREAT|0666);
		SYSERROR(shmid, "shmget");

		f = shmat(shmid, NULL, 0);
		SYSERROR(f, "shmat");

		(*f)++;
		printf("WAKE: %p{%x}\n", f, *f);
		tmp = futex(f, FUTEX_WAKE, 1, NULL, NULL, 0);
		SYSERROR(tmp, "futex");
		printf("WOKE: %d\n", tmp);

		tmp = shmdt(f);
		SYSERROR(tmp, "shmdt");

		exit(0);
	}

The first program will set up a SYSV IPC SHM segment and wait on a futex in it
for the number at the start to change.  The program will increment that number
and wake the first program up.  This leads to output of the form:

	SHELL 1			SHELL 2
	=======================	=======================
	# /dowait
	WAIT: 0xc32ac000{0}
				# /dowake
				WAKE: 0xc32ac000{1}
	WAITED: 0		WOKE: 1

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:15 -07:00
..
Kconfig
Makefile [PATCH] Extract the allocpercpu functions from the slab allocator 2006-09-26 08:48:51 -07:00
allocpercpu.c [PATCH] Extract the allocpercpu functions from the slab allocator 2006-09-26 08:48:51 -07:00
bootmem.c [PATCH] bootmem: use MAX_DMA_ADDRESS instead of LOW32LIMIT 2006-09-26 08:48:49 -07:00
fadvise.c [PATCH] fadvise() make POSIX_FADV_NOREUSE a no-op 2006-08-06 08:57:47 -07:00
filemap.c [PATCH] update some mm/ comments 2006-09-26 08:48:49 -07:00
filemap.h
filemap_xip.c
fremap.c [PATCH] mm: small cleanup of install_page() 2006-09-26 08:48:44 -07:00
highmem.c [PATCH] reduce MAX_NR_ZONES: move HIGHMEM counters into highmem.c/.h 2006-09-26 08:48:46 -07:00
hugetlb.c [PATCH] NUMA: Add zone_to_nid function 2006-09-26 08:48:52 -07:00
internal.h [PATCH] mm: VM_BUG_ON 2006-09-26 08:48:44 -07:00
madvise.c
memory.c [PATCH] NOMMU: Check that access_process_vm() has a valid target 2006-09-27 08:26:14 -07:00
memory_hotplug.c [PATCH] memory hotadd fixes: enhance collision check 2006-08-06 08:57:49 -07:00
mempolicy.c [PATCH] GFP_THISNODE for the slab allocator 2006-09-27 08:26:12 -07:00
mempool.c [PATCH] dm: work around mempool_alloc, bio_alloc_bioset deadlocks 2006-09-01 11:39:09 -07:00
migrate.c [PATCH] Define easier to handle GFP_THISNODE 2006-09-26 08:48:50 -07:00
mincore.c
mlock.c
mmap.c [PATCH] ZVC: Support NR_SLAB_RECLAIMABLE / NR_SLAB_UNRECLAIMABLE 2006-09-26 08:48:51 -07:00
mmzone.c [PATCH] mm/mmzone.c: EXPORT_UNUSED_SYMBOL 2006-07-10 13:24:17 -07:00
mprotect.c [PATCH] mm: optimize the new mprotect() code a bit 2006-09-26 08:48:44 -07:00
mremap.c
msync.c [PATCH] mm: msync() cleanup 2006-09-26 08:48:45 -07:00
nommu.c [PATCH] NOMMU: Make futexes work under NOMMU conditions 2006-09-27 08:26:15 -07:00
oom_kill.c [PATCH] NUMA: Add zone_to_nid function 2006-09-26 08:48:52 -07:00
page-writeback.c [PATCH] mm: non syncing lock_page() 2006-09-26 08:48:48 -07:00
page_alloc.c [PATCH] mm/page_alloc: use NULL instead of 0 for ptr 2006-09-27 08:26:13 -07:00
page_io.c [PATCH] swsusp: read speedup 2006-09-26 08:48:58 -07:00
pdflush.c
prio_tree.c
readahead.c
rmap.c [PATCH] mm: tracking shared dirty pages 2006-09-26 08:48:44 -07:00
shmem.c [PATCH] Really ignore kmem_cache_destroy return value 2006-09-27 08:26:10 -07:00
slab.c [PATCH] GFP_THISNODE for the slab allocator 2006-09-27 08:26:12 -07:00
slob.c [PATCH] Make kmem_cache_destroy() return void 2006-09-27 08:26:11 -07:00
sparse.c
swap.c [PATCH] mm/: make functions static 2006-09-26 08:48:45 -07:00
swap_state.c
swapfile.c [PATCH] swsusp: Fix swap_type_of 2006-08-27 11:01:28 -07:00
thrash.c
tiny-shmem.c
truncate.c [PATCH] page invalidation cleanup 2006-09-27 08:26:12 -07:00
util.c
vmalloc.c [PATCH] Mark __remove_vm_area() static 2006-09-27 08:26:13 -07:00
vmscan.c [PATCH] page invalidation cleanup 2006-09-27 08:26:12 -07:00
vmstat.c [PATCH] zone_statistics: Use hot node instead of cold zone_pgdat 2006-09-27 08:26:13 -07:00