Re: [patch /proc] Speedup /proc/pid/maps

From: William Lee Irwin III
Date: Wed Jan 05 2005 - 15:45:18 EST


On Wed, Jan 05, 2005 at 12:55:37PM -0800, pmeda@xxxxxxxxxx wrote:
> This patch uses find_vma() to improve the read response of /proc/pid/maps.
> It attempts to make the liner scan instead of quadratic walk and utilise
> rb tree. Reading the file was doing sequential scan from the begining to
> file position all the time, and taking a quite long time.
> The improvements came from f_version/m_version and resulting in
> mmap_cache match. Even if mmap_cache does not match, rb tree walk
> should be faster than sequential walk. First attempt was to put the
> state across read system calls into private data. Later got
> inspiration from wli's pid patch using f_version in readdir of /proc.
> Other advantage is, f_version will be cleared automatically by lseek.
> The test program creates 32K maps and splits them into two(limited by
> max_map_count sysctl) using mprotect(0). After the patch, the read
> time improves from many seconds to milliseconds, and does not grow
> superlinearly with number of read calls.
> Help taken from Peter Swain in idea and testing.

This is an excellent improvement which makes kernel instrumentation
interfere less with the instrumented workload. I wholly endorse it.


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