Re: memmove syscall
From: Nikolay Igotti
Date: Thu Feb 05 2004 - 23:50:16 EST
Rik van Riel wrote:
On Wed, 4 Feb 2004, Nikolay Igotti wrote:
Maybe this is kinda crazy (or known) idea, but why don't we create
syscall allowing large copies by just manipulating MMU page table, i.e.
return mmu_remap_pages(src, dst, size / PAGE_SIZE);
Did you look at mremap(2) ?
If I get it correctly:
mremap expands (or shrinks) an existing memory mapping,
potentially
moving it at the same time (controlled by the flags argument
and the
available virtual address space).
And this syscall can be only used for realloc() kind of stuff, as you're
not allowed to change
virtual address of some page to desired value, but whole point is to
allow very fast page-aligned
memory moving (or to be exact - swapping, as I guess dst pages should be
mapped where src ones was
mapped before, to keep things sane).
Obvious applications for this syscall - Large Object Spaces in
different memory management systems
- if space is allocated in pages, defragmentation becomes very cheap.
Also there could be other applications, like execution-time program
obfuscators, just shuffling
program stack and data in fancy way :), or tools for improvment of
interactive behavior of
KDE/Gnome by putting images (or other location-neutral(pointerless)
data) into nearby virtual
memory locations (so they'll be swapped in and out together, as they
should).
If it can be achieved with existing syscalls, I'd be happy to know how
to do that :).
Thanks,
Nikolay
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/