sematics of vm_operations_struct.wppage() ?

Noel Burton-Krahn (noel@harleystreet.com)
Mon, 12 Jan 1998 10:46:25 -0800


Yet more questions from the depths of the kernel. (2.0.32)

I would like to make a special kind of task which keeps a list of the pages
that it dirties. Simple, I thought: take all my writable pages,
write-protect them, and define vm_operations_struct.wppage() to
un-write-protect and insert them into my dirty list. Every time I write to
a page, my wppage() will update my task's dirty list and clear the wp bit.
Of course, there's a catch.

vm_operations_struct.wppage() is not called from anywhere in my version of
the kernel. All the copy-on-write stuff is handled in do_wp_page() and it
never calls wppage(). Presumably, wppage was defined in earlier versions
of the kernel but later removed when someone thought: who would ever use
that?

I would like to use it, and so I would like to put it back. My question is
where? The prototype:
unsigned long (*wppage)(struct vm_area_struct * area, unsigned long
address, unsigned long page);

declares that wppage should return an unsigned long. How exactly should
the return type be interpreted? Should it be the new page for
copy-on-write or the original page with the write protect bit cleared?
Where exactly should do_wp_page call wppage() and what should it do with
the return?

Linus?

--Noel