Re: do_generic_mapping_read performance issue

From: Ashif Harji
Date: Mon Mar 12 2007 - 12:47:44 EST



The implication of this code is that for files of size less than or equal
to a single page, the page associated with such a file is likely to get
evicted from the cache regardless of how frequently it is accessed. The
reason is that after the first access, prev_index is always zero and index
can only be zero. Hence, mark_page_accessed is never called after the
first time the file is requested. As a result, the page is evicted from
the cache no matter how frequently it is used. By changing the kernel to
always call mark_page_accessed for these files, the server throughput is
increased by as much as 20%.
Your analysis seems to be right. But to observe this behaviour you have
to have the file open and just always reread it using the same file
descriptor, don't you? That's probably not too common...

Yes, this problem requires the file to be accessed via the same file descriptor. I suspect this behaviour is common for a certain class of applications, e.g., web servers. However, any application that read from the same page repeatedly would also experience this problem. It is more likely to occur with small files, but not exculsively.

ashif.
-
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/