2001-02-09 04:15:02

by Daniel Stodden

[permalink] [raw]
Subject: paging question


hi.

i desperately hope this is not too stupid.

i'm trying to write a driver which depends on giving pci devices
access to somewhat larger amounts of pysical memory. let's say, a
megabyte of contiguous ram.

is it possible to resize such an area later on? i mean: is there some
mechanism available in the kernel to enlarge such a region even if the
area beyond it is already in use?

i understand that this is pretty impossible if some entity depends on
correct physical locations of the pages in question. but couldn't for
example userland memory be copied elsewhere and its new location
simply remapped?

regards,
dns

--
___________________________________________________________________________
mailto:[email protected]


2001-02-09 13:36:40

by Rik van Riel

[permalink] [raw]
Subject: Re: paging question

On Fri, 9 Feb 2001, Daniel Stodden wrote:

> i desperately hope this is not too stupid.

Only if the hardware is so stupid that you need this ;)

> i'm trying to write a driver which depends on giving pci devices
> access to somewhat larger amounts of pysical memory. let's say, a
> megabyte of contiguous ram.
>
> is it possible to resize such an area later on? i mean: is there some
> mechanism available in the kernel to enlarge such a region even if the
> area beyond it is already in use?
>
> i understand that this is pretty impossible if some entity depends on
> correct physical locations of the pages in question. but couldn't for
> example userland memory be copied elsewhere and its new location
> simply remapped?

Currently Linux doesn't have any way to figure out which
programs are using a certain physical memory location, so
we cannot efficiently unmap the memory.

And even if we could ... what if the memory is in use by
the kernel itself and there are pointers to those kernel
addresses somewhere else in the kernel ? These pages
would be unfreeable anyway...

regards,

Rik
--
Linux MM bugzilla: http://linux-mm.org/bugzilla.shtml

Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

http://www.surriel.com/
http://www.conectiva.com/ http://distro.conectiva.com/

2001-02-09 15:32:55

by Jeff Hartmann

[permalink] [raw]
Subject: Re: paging question

Daniel Stodden wrote:

> hi.
>
> i desperately hope this is not too stupid.
>
> i'm trying to write a driver which depends on giving pci devices
> access to somewhat larger amounts of pysical memory. let's say, a
> megabyte of contiguous ram.

Your unlikely to get 1 MB of contigous ram unless you grab it very early
in the boot process. This means your driver needs to be built into the
kernel, it can't be a module.

>
>
> is it possible to resize such an area later on? i mean: is there some
> mechanism available in the kernel to enlarge such a region even if the
> area beyond it is already in use?

No.

>
>
> i understand that this is pretty impossible if some entity depends on
> correct physical locations of the pages in question. but couldn't for
> example userland memory be copied elsewhere and its new location
> simply remapped?

If we had reverse page tables we could perhaps do this sort of
remapping. Currently there is no way to detrimine which physical page
maps to which userland page without scanning every processes page
tables. There is also the possibility that the memory is used by the
kernel, in which case your basically out of luck.

-Jeff