Subject: vm_object_page_clean: pager_put error ??
To: None <current-users@NetBSD.ORG>
From: Tim W. Janes <>
List: current-users
Date: 11/26/1996 21:24:31
Hi all,

One of our NetBSD users is trying to port a program that uses mmap
from DEC OSF/1 to NetBSD and is having a lot of problems. 

I notice quite a number of the following error messages in the NetBSD
log that are clearly related to his problem:-

Nov 20 10:53:17 titan7 /netbsd: vm_object_page_clean: pager_put error
Nov 20 11:14:24 titan7 /netbsd: vm_object_page_clean: pager_put error
Nov 20 12:00:20 titan7 /netbsd: vm_object_page_clean: pager_put error

Any clues as to what is happening? Is this a problem with his code or
a problem with NetBSD?

I append a recent posting of his describing the problem.
(He apparently has also tried call msync without any improvement)

This is on PentiumPro's with 128Mbytes memory running 1.2BETA as of
mid July. 

These machines are heavily used as batch processors so haven't yet
been updated but this problem and the recent comment that the
performace problems of the VM system have been fixed seem to indicate
that it is time to update to 1.2 or -current - any recomendations as
to which? 

Currently when a large (150Mbyte) batch job starts the system appears
to be dead to everything except ping for several minutes after which
performance returns to normal with the batch job using > 95%CPU.

TIA for any help/advice.


Tim Janes                   | e-mail :
Defence Research Agency     |    tel : +44 1684 894100
Malvern  Worcs              |    fax : +44 1684 895103
Gt Britain                  |   #include <std/disclaim.h>

> Hi,
>    I am having a problem when trying to use mmap to modifiy an existing
> file and was wondering whether anybody could help me with it.
>    I mmap a file for read and write access and change some of it. I
> then observe two problems
> 1) when the file is very large (just over 218Meg), some of the modifications
> seem to be written, some not. (this only seems to be a pb on networked files,
> it works on a local file).
> 2) the fact whether I look at some of the fields under gdb or not, seems to
> influence whehter it works or not. For example, even on a small (12 byte)
> local file, it doesn't work when I print those bytes from within gdb (with
> p *PInt@3) before I unmap it, but works fine if I don't print it [the
> print statements in all cases gives the correct value, it just doesn't seem
> to go through to the file].
> Now am I doing really stupid (e.g. not use the mmap call in the right
> manner) or is there a bug? I'll append the small pg I am using (<50 lines)
> at the end of this mail. It works fine when compiled f.ex. on OSF/1, but not
> on netbsd. any help would be much appreciated - since I am not a regular
> reader of this list, it would be great if you could email your comments
> to
> cheerio,
> Joerg Ueberla

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>

main(int argc, char **argv)
int  *PInt, NewVal, i, NbBytes, Ret;
char FName[500];
struct stat stat_buf;
caddr_t Map;

//sprintf(FName, "/home/ueberla/proj/src/lib/f1");
sprintf(FName, "%s", argv[1]);
FP=fopen(FName, "r+");
fstat(fileno(FP), &stat_buf);
#if defined(__NetBSD__)
   Map=(caddr_t)mmap(NULL, NbBytes, PROT_WRITE|PROT_READ, MAP_FILE|MAP_SHARED, fileno(FP), 0);
   Map=(caddr_t)mmap(NULL, NbBytes, PROT_WRITE|PROT_READ, MAP_FILE|MAP_VARIABLE|MAP_SHARED, fileno(FP), 0);
PInt=(int *)Map;
    fprintf(stdout,"i=%d\n", i);
fprintf(stdout,"PInt[0]=%d\n", PInt[0]);
Ret=munmap(Map, NbBytes);