The implication of this code is that for files of size less than or equalYour analysis seems to be right. But to observe this behaviour you have
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%.
to have the file open and just always reread it using the same file
descriptor, don't you? That's probably not too common...