public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* do_generic_mapping_read performance issue
@ 2007-03-09 22:03 Ashif Harji
  2007-03-12 14:20 ` Jan Kara
  0 siblings, 1 reply; 41+ messages in thread
From: Ashif Harji @ 2007-03-09 22:03 UTC (permalink / raw)
  To: linux-kernel


Hi, I am encountering a performance problem, which I have tracked into the 
Linux kernel. The problem occurs with my experimental web server that uses 
sendfile to repeatedly transmit files.  The files are based on the static 
portion of the SPECweb99 fileset and range in size to model a reasonable 
workload.  With this workload, a significant number of the requests are 
for files of size 4 KB or less.

I have determined that the performance problems occurs in the function
do_generic_mapping_read in file mm/filemap.c for kernel version 2.6.20.1.
Here is the specific code fragment:

         /*
          * When (part of) the same page is read multiple times
          * in succession, only mark it as accessed the first time.
          */
         if (prev_index != index)
                 mark_page_accessed(page);


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%.

I was wondering if anyone could explain why the call to mark_page_accessed 
is conditional? That is, what problem it is trying to solve. It would seem 
that in many scenarios, if the same page is accessed repeatedly, then it 
would be appropriate to keep that page cached.

Please personally CC me on any responses.

thanks,
ashif.

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2007-03-16 14:23 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-09 22:03 do_generic_mapping_read performance issue Ashif Harji
2007-03-12 14:20 ` Jan Kara
2007-03-12 14:39   ` Nick Piggin
2007-03-12 15:13     ` Jan Kara
2007-03-12 17:05       ` Ashif Harji
2007-03-12 17:35         ` Jan Kara
2007-03-13 18:43           ` Ashif Harji
2007-03-13 18:55             ` Jan Kara
2007-03-14 19:58               ` [PATCH] mm/filemap.c: unconditionally call mark_page_accessed Ashif Harji
2007-03-14 20:55                 ` Dave Kleikamp
2007-03-14 21:33                   ` Andreas Mohr
2007-03-14 22:08                     ` Dave Kleikamp
2007-03-15  1:36                       ` Xiaoning Ding
2007-03-15  5:22                         ` Ashif Harji
2007-03-15 12:46                           ` Dave Kleikamp
2007-03-15 12:50                             ` Nick Piggin
2007-03-15 19:07                           ` Andrew Morton
2007-03-15 21:49                             ` Andrea Arcangeli
2007-03-15 22:06                               ` Andrew Morton
2007-03-15 23:15                                 ` Andrea Arcangeli
2007-03-15 15:00                     ` Rik van Riel
2007-03-15 17:37                     ` Valdis.Kletnieks
2007-03-15 18:35                       ` Rik van Riel
2007-03-16  3:51                         ` Valdis.Kletnieks
2007-03-16  4:09                           ` Rik van Riel
2007-03-16 14:20                   ` Anton Blanchard
2007-03-15 10:39                 ` Peter Zijlstra
2007-03-15 12:38                   ` Nick Piggin
2007-03-15 15:06                     ` Rik van Riel
2007-03-15 15:56                 ` Chuck Ebbert
2007-03-15 16:29                   ` Nick Piggin
2007-03-15 17:04                     ` Rik van Riel
2007-03-15 17:44                     ` Hugh Dickins
2007-03-15 20:01                       ` Nick Piggin
2007-03-15 22:59                       ` Andrea Arcangeli
2007-03-15 23:15                         ` Dave Kleikamp
2007-03-15 23:28                           ` Andrea Arcangeli
2007-03-15 19:55                     ` Ashif Harji
2007-03-15 20:07                       ` Nick Piggin
2007-03-15 20:31                         ` Andreas Mohr
2007-03-12 16:46   ` do_generic_mapping_read performance issue Ashif Harji

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox