public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* VMM:  syscall for reordering pages in vm
@ 2004-11-08 10:51 Willibald Krenn
  2004-11-08 12:04 ` Arjan van de Ven
  0 siblings, 1 reply; 4+ messages in thread
From: Willibald Krenn @ 2004-11-08 10:51 UTC (permalink / raw)
  To: linux-kernel

Quick Summary:

(Good or Bad?) Idea of implementing a syscall that allows
for virtual memory page exchange by modifying the physical<->virtual
page mapping. Intended usage: Moving pages in virtual memory without
the need to copy them. Feedback welcome!



Longer Version:

I need some advice from the Linux VMM-gurus on following idea: Suppose
a user-land program wants to re-order memory it has allocated and
suppose further that this program has done allocations in a way that the
reordering can be done by exchanging whole pages in virtual memory, as
indicated below.

Page5  Program.. (part 2)
Page4  swappedout/"free"
Page3  Program.. (part 3)
Page2  Program.. (part 4)
Page1  swappedout/"free"
Page0  Program.. (part 1)

How about implementing a system call that allows the user-program to
exchange pages? In the example above e.g. Page 5/Page 1 and
Page 3/Page 2.
As far as I understand, the system call would 'just' have to change the
physical<->virtual mapping of these pages and the exchange would be done
without having to copy -in the example above- 4*PageSize bytes in 
userland. (Of course there are some additional benefits in the given 
example, as there is no need to swap in a page as a buffer for the 
copy-operation...)


However, before investigating this idea any further, I figured it would 
be best to ask for comments from the experts here.. (I've barely any 
knowledge about the Linux-VMM and therefore my idea might be complete 
and utter nonsense.)
Any kind of feedback is greatly appreciated!


Thanks for all your time,
  Willibald Krenn


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

* Re: VMM:  syscall for reordering pages in vm
  2004-11-08 10:51 VMM: syscall for reordering pages in vm Willibald Krenn
@ 2004-11-08 12:04 ` Arjan van de Ven
  2004-11-08 12:27   ` Willibald Krenn
  0 siblings, 1 reply; 4+ messages in thread
From: Arjan van de Ven @ 2004-11-08 12:04 UTC (permalink / raw)
  To: Willibald Krenn; +Cc: linux-kernel

On Mon, 2004-11-08 at 11:51 +0100, Willibald Krenn wrote:
> Quick Summary:
> 
> (Good or Bad?) Idea of implementing a syscall that allows
> for virtual memory page exchange by modifying the physical<->virtual
> page mapping. Intended usage: Moving pages in virtual memory without
> the need to copy them. Feedback welcome!

eh isn't this already possible with mmap and mremap ?


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

* Re: VMM:  syscall for reordering pages in vm
  2004-11-08 12:04 ` Arjan van de Ven
@ 2004-11-08 12:27   ` Willibald Krenn
  2004-11-09  3:05     ` William Lee Irwin III
  0 siblings, 1 reply; 4+ messages in thread
From: Willibald Krenn @ 2004-11-08 12:27 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel

Arjan van de Ven schrieb:
> On Mon, 2004-11-08 at 11:51 +0100, Willibald Krenn wrote:
>> virtual memory page exchange by modifying the physical<->virtual
>>page mapping. 
> 
> eh isn't this already possible with mmap and mremap ?

If I'm not mistaken: You can not tell mmap and mremap to explicitely 
exchange two pages. (Mremap resizes an existing memory mapping.)

Perhaps I did not explain my idea good enough: I want something along 
the lines "Current memory contents in page starting at address X move to 
address Y and the contents of the page starting at address Y shall be 
found at address X in future".


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

* Re: VMM:  syscall for reordering pages in vm
  2004-11-08 12:27   ` Willibald Krenn
@ 2004-11-09  3:05     ` William Lee Irwin III
  0 siblings, 0 replies; 4+ messages in thread
From: William Lee Irwin III @ 2004-11-09  3:05 UTC (permalink / raw)
  To: Willibald Krenn; +Cc: Arjan van de Ven, linux-kernel

Arjan van de Ven schrieb:
>> eh isn't this already possible with mmap and mremap ?

On Mon, Nov 08, 2004 at 01:27:10PM +0100, Willibald Krenn wrote:
> If I'm not mistaken: You can not tell mmap and mremap to explicitely 
> exchange two pages. (Mremap resizes an existing memory mapping.)
> Perhaps I did not explain my idea good enough: I want something along 
> the lines "Current memory contents in page starting at address X move to 
> address Y and the contents of the page starting at address Y shall be 
> found at address X in future".

You're thinking of POSIX mremap(2); Linux' actual mremap() ABI allows
relocation of pages within a process address space, though only to
previously unoccupied locations, not direct exchange.


-- wli

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

end of thread, other threads:[~2004-11-09  3:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-08 10:51 VMM: syscall for reordering pages in vm Willibald Krenn
2004-11-08 12:04 ` Arjan van de Ven
2004-11-08 12:27   ` Willibald Krenn
2004-11-09  3:05     ` William Lee Irwin III

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