linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: linux vm page sharing
@ 2003-11-10 14:45 Mark_H_Johnson
  0 siblings, 0 replies; 3+ messages in thread
From: Mark_H_Johnson @ 2003-11-10 14:45 UTC (permalink / raw)
  To: Sharath Kodi Udupa; +Cc: linux-mm




>i am trying to implement a system where different processes can share
>pages, this means that not only same executables, but different
>executables , but when the pages required are same.

Why not use one of the existing memory management functions such as:
 - mmap, munmap to map a file into memory (this also provides persistence)
 - shmget, shmat, shmdt, shmctl to create, attach, detach, and control
shared memory segments. The status of these is also available through the
ipcs command line program. Also look at "man 5 ipc" to get a summary of
interprocess communications methods (semaphores, shared memory, message
queues).
Note that the base address of the memory segments are not necessarily the
same in each executable. This means you should always use offsets (relative
to the base of shared memory) to locate items within the shared memory
area. For example, you code would compute the "real address" as the "base
address" plus "offset" before dereferencing pointers. Trying to force the
base address of the shared memory is "hard" and prone to problems due to
the relative size of the executables.

>[snip - looking at page structure]
I would use just the documented interfaces for shared memory.

--Mark H Johnson
  <mailto:Mark_H_Johnson@raytheon.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

* Re: linux vm page sharing
  2003-11-08  0:35 Sharath Kodi Udupa
@ 2003-11-08  1:53 ` Raghu R. Arur
  0 siblings, 0 replies; 3+ messages in thread
From: Raghu R. Arur @ 2003-11-08  1:53 UTC (permalink / raw)
  To: Sharath Kodi Udupa; +Cc: linux-mm


  I think the idea you are proposing is already present in linux. If two 
executables are using the same library file, then there wont be two 
instances of the page of that library file..

 The address_space in the page maps to the the inode of the file that the 
page is mapped to (in case of a file mapped file) or it will be NULL for 
non-mapped pages. In 2.6 mm, the pages that hold the page table entries of 
a process use this mapping to map to the mm_struct of that process.

 HTH,
 Raghu

On Fri, 7 Nov 2003, Sharath Kodi Udupa wrote:

> hi,
> 
> i am trying to implement a system where different processes can share
> pages, this means that not only same executables, but different
> executables , but when the pages required are same.
> but i see in the linux page structure, it keeps a pointer to the
> address_space mapping, but now since if the second process also needs to
> share the page,this wont be the same mapping. so i am planning to add the
> page table entry to the second process, but to leave the
> struct address_space *mapping pointer to whatever it was earlier. I plan
> to do this since, i dont really understand how this is used and also have
> gone through the code to understand it. What significance does this hold?
> 
> any pointers is greatly appreciated
> 
> regards,
> 
> Sharath K Udupa
> Graduate Student,
> Dept. of Computer Science,
> University of Arizona.
> sku@cs.arizona.edu
> http://www.cs.arizona.edu/~sku
> 
> "Sometimes I think the surest sign that intelligent life exists
> elsewhere in the universe is that none of it has tried to contact us."
> --Calvin, The Indispensable Calvin and Hobbes
> 
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

* linux vm page sharing
@ 2003-11-08  0:35 Sharath Kodi Udupa
  2003-11-08  1:53 ` Raghu R. Arur
  0 siblings, 1 reply; 3+ messages in thread
From: Sharath Kodi Udupa @ 2003-11-08  0:35 UTC (permalink / raw)
  To: linux-mm

hi,

i am trying to implement a system where different processes can share
pages, this means that not only same executables, but different
executables , but when the pages required are same.
but i see in the linux page structure, it keeps a pointer to the
address_space mapping, but now since if the second process also needs to
share the page,this wont be the same mapping. so i am planning to add the
page table entry to the second process, but to leave the
struct address_space *mapping pointer to whatever it was earlier. I plan
to do this since, i dont really understand how this is used and also have
gone through the code to understand it. What significance does this hold?

any pointers is greatly appreciated

regards,

Sharath K Udupa
Graduate Student,
Dept. of Computer Science,
University of Arizona.
sku@cs.arizona.edu
http://www.cs.arizona.edu/~sku

"Sometimes I think the surest sign that intelligent life exists
elsewhere in the universe is that none of it has tried to contact us."
--Calvin, The Indispensable Calvin and Hobbes


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

end of thread, other threads:[~2003-11-10 14:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-10 14:45 linux vm page sharing Mark_H_Johnson
  -- strict thread matches above, loose matches on Subject: below --
2003-11-08  0:35 Sharath Kodi Udupa
2003-11-08  1:53 ` Raghu R. Arur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox