linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: mmap inside kernel memory.
  2003-02-09  0:58 mmap inside kernel memory Jerome de Vivie
@ 2003-02-09  0:00 ` Rik van Riel
  2003-02-09  1:50   ` Jerome de Vivie
  0 siblings, 1 reply; 5+ messages in thread
From: Rik van Riel @ 2003-02-09  0:00 UTC (permalink / raw)
  To: Jerome de Vivie; +Cc: linux-kernel

On Sun, 9 Feb 2003, Jerome de Vivie wrote:

> "mmap" seems to be design for mapping file or device inside a process
> memory. Is it possible to map a file into the kernel virtual memory ?

In theory yes (using vmalloc space), but you really don't want to.

Rik
-- 
Bravely reimplemented by the knights who say "NIH".
http://www.surriel.com/		http://guru.conectiva.com/
Current spamtrap:  <a href=mailto:"october@surriel.com">october@surriel.com</a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* mmap inside kernel memory.
@ 2003-02-09  0:58 Jerome de Vivie
  2003-02-09  0:00 ` Rik van Riel
  0 siblings, 1 reply; 5+ messages in thread
From: Jerome de Vivie @ 2003-02-09  0:58 UTC (permalink / raw)
  To: linux-kernel


"mmap" seems to be design for mapping file or device inside a process
memory. Is it possible to map a file into the kernel virtual memory ?

kind regards,

j.

-- 
Jérôme de Vivie

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mmap inside kernel memory.
  2003-02-09  0:00 ` Rik van Riel
@ 2003-02-09  1:50   ` Jerome de Vivie
  2003-02-09  1:51     ` Rik van Riel
  0 siblings, 1 reply; 5+ messages in thread
From: Jerome de Vivie @ 2003-02-09  1:50 UTC (permalink / raw)
  To: Rik van Riel; +Cc: linux-kernel

Rik van Riel wrote:
> 
> On Sun, 9 Feb 2003, Jerome de Vivie wrote:
> 
> > "mmap" seems to be design for mapping file or device inside a process
> > memory. Is it possible to map a file into the kernel virtual memory ?
> 
> In theory yes (using vmalloc space), but you really don't want to.

Yes, it's very tricky ! I have (naïvly) try this:

vaddr=vmalloc(len);
do_mmap(file ,kvaddr ,len ,PROT_READ|PROT_WRITE ,MAP_FIXED|MAP_PRIVATE
,0);

Here, do_mmap check if the addresse match inside current process and
return me -ENOMEM. Are there others functions which i could use to
associate this file and a vmalloc'ed space ?


j.

-- 
Jérôme de Vivie

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mmap inside kernel memory.
  2003-02-09  1:50   ` Jerome de Vivie
@ 2003-02-09  1:51     ` Rik van Riel
  2003-02-09 13:43       ` Jerome de Vivie
  0 siblings, 1 reply; 5+ messages in thread
From: Rik van Riel @ 2003-02-09  1:51 UTC (permalink / raw)
  To: Jerome de Vivie; +Cc: linux-kernel

On Sun, 9 Feb 2003, Jerome de Vivie wrote:

> Here, do_mmap check if the addresse match inside current process and
> return me -ENOMEM. Are there others functions which i could use to
> associate this file and a vmalloc'ed space ?

As I said, you don't want to mmap a file in kernel memory.
You only have 128 MB of vmalloc space and you don't want to
waste it.

If you know which addresses within the file you want to
access, why don't you access them through the page cache
functions ?

regards,

Rik
-- 
Bravely reimplemented by the knights who say "NIH".
http://www.surriel.com/		http://guru.conectiva.com/
Current spamtrap:  <a href=mailto:"october@surriel.com">october@surriel.com</a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mmap inside kernel memory.
  2003-02-09  1:51     ` Rik van Riel
@ 2003-02-09 13:43       ` Jerome de Vivie
  0 siblings, 0 replies; 5+ messages in thread
From: Jerome de Vivie @ 2003-02-09 13:43 UTC (permalink / raw)
  To: Rik van Riel; +Cc: linux-kernel

Rik van Riel wrote:
> 
> On Sun, 9 Feb 2003, Jerome de Vivie wrote:
> 
> > Here, do_mmap check if the addresse match inside current process and
> > return me -ENOMEM. Are there others functions which i could use to
> > associate this file and a vmalloc'ed space ?
> 
> As I said, you don't want to mmap a file in kernel memory.
> You only have 128 MB of vmalloc space and you don't want to
> waste it.
> 
> If you know which addresses within the file you want to
> access, why don't you access them through the page cache
> functions ?

Ok. I will go through the page cache.

regards,

j.

-- 
Jérôme de Vivie

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-02-09 12:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-09  0:58 mmap inside kernel memory Jerome de Vivie
2003-02-09  0:00 ` Rik van Riel
2003-02-09  1:50   ` Jerome de Vivie
2003-02-09  1:51     ` Rik van Riel
2003-02-09 13:43       ` Jerome de Vivie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).