Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 May 2008 13:20:32 +0300
From:      Teemu Rinta-aho <teemu@rinta-aho.org>
To:        freebsd-hackers@freebsd.org
Subject:   copy-on-write anonymous memory?
Message-ID:  <482C0E70.4020305@rinta-aho.org>

next in thread | raw e-mail | index | archive | help
Hi all,

is it possible to create a memory object that represents
anonymous memory pages *and* is copy-on-write?

I have this code in a kernel module:

    object = vm_object_allocate(OBJT_DEFAULT, 1);

    result = vm_map_find(vmmap_proc,
                         object,
                         0,
                         &addr,
                         len,
                         TRUE,
                         VM_PROT_ALL,
                         VM_PROT_ALL,
                         MAP_COPY_ON_WRITE);

Then I pass the addr to the user space, but when
I write to the addr, I see no shadow objects created,
i.e. the changes are written to the original memory
pages no matter if I have the map entry set as
copy-on-write or not... I am assuming a write fault would
create a new page and hang it to a shadow object thus
leaving the original memory untouched.

I'd appreciate any kind of help here.

Best regards,
Teemu Rinta-aho



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?482C0E70.4020305>