mmapping large files hits swap in 2.4?

Daniel Egger (degger@fhm.edu)
09 Aug 2002 19:26:14 +0200


Hija,

I'm currently looking into optimizing GIMPs own swapping algorithm
by replacing naive file operations by mmap-based ones. Unfortunately
my test machine (PPC, 256MB) gets hit really hard by mmapping files over
100MB into memory: The swap utilization grows up to the file size
and the machine is completely unresponsive for several seconds up to
a few minutes. Seemingly the writes to the mmaped area first hit the
swap and then are read from there again to fit the designated file.

I'm doing something along the lines of:
area = mmap (0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);

I also tried MAP_PRIVATE and MAP_LOCKED both with a private and a
shared mapping, but to no avail.

This is kernel version 2.4.19-rc3 (in the benh-variant).

Is there anything I can do to improve the situation or is it just
the kernel or the architecture?

-- 
Servus,
       Daniel

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/