On Mon, 31 May 1999, Erwin Rol wrote:
> In the documentation on the RT-Linux website
> it is said that the shared memory must be smaller
> than the page size. Is this (still) true, and is
> it posible to have bigger amounts of shared memory, for
> example 32Mb ?
I do not think that using the method with reservation of memory at boot you
are limited.
But I agree that this method is too static - sometimes amount of memory needs
to be changed. I have written a simple driver allowing you to allocate in the
kernel module any amount of memory, which is them mmappable though a 10,254
cheracter device. You can get it at:
http://crds.chemie.unibas.ch/PCI-MIO-E/mbuff-0.4.tar.gz
API:
in the kernel:
extern int shm_allocate(unsigned int size, void **shm);
extern int shm_deallocate(void * shm);
example:
struct myshm *shm;
shm_allocate(1024*1024*32,(void **) &shm);
at this point you can mmap it from user program.
shm->a =20; use it any way;
shm_deallocate(shm); /* the memory will be freed on the last unmap
by the user */
user space: see tester.c example.
access through misc device (enable MISC in the kernel):
crw-r--r-- 1 root root 10, 254 Apr 24 14:19 rtl_shm
Should work without problems (if your system can work with 32M taken away):
download, uncompress, "make test".
You may wish to change 1024*1024 to 1024*1024*32 in mmap.c
I have tested it:
[motyl@crds motyl]$ free (before insmod)
total used free shared buffers cached
Mem: 126736 125616 1120 70004 564 16768
-/+ buffers/cache: 108284 18452
Swap: 130044 14812 115232
[motyl@crds motyl]$ free (after insmod rtl_shm.o)
total used free shared buffers cached
Mem: 94992 93744 1248 47768 420 14516
-/+ buffers/cache: 78808 16184
Swap: 130044 41664 88380
[motyl@crds motyl]$ free (after rmmod rtl_shm)
total used free shared buffers cached
Mem: 127764 92768 34996 48068 604 14624
-/+ buffers/cache: 77540 50224
Swap: 130044 43008 87036
It can assemble big block even from a fragmented memory, sending things to
swap of neccesary. This memory is only logically in one block. But you would
care only when doing DMA with non scatter-gather capable device.
--
Tomek
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/