Subject: Page daemon behavior part N+2
To: None <tech-kern@netbsd.org>
From: Charles M. Hannum <root@ihack.net>
List: tech-kern
Date: 01/25/2001 04:22:13
Looking more closely at the way we handle MADV_SEQUENTIAL and
MADV_DONTNEED, it seems to me that this is actually *wrong*.  The
current implementation works by explicitly deactivating the pages.
While this gives a slight paging disadvantage to those pages, it also
actively penalizes other processes using the same data.

It seems to me that it should actually:

* Rather than deactivating the pages, remove them from the pmap
  instead, thus lowering their reference counts.

* When the reference count on a page drops to 0, and it is `active',
  then deactivate it.

In addition to fixing the madvise(2) problem (and the potential for
related DoS attacks, which I won't go into here), this could also
potentially improve behavior with UBC by causing pages released by UBC
to be implicitly deactivated.

Anyone have further thoughts on this?