public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: wli@movementarian.org
To: Pavel Levshin <lpk@581.spb.su>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Major page faults counter is zero with MADV_RANDOM
Date: Wed, 4 Feb 2009 17:38:36 -0500	[thread overview]
Message-ID: <20090204223836.GE10229@movementarian.org> (raw)
In-Reply-To: <49898573.8070509@581.spb.su>

On Wed, Feb 04, 2009 at 03:09:23PM +0300, Pavel Levshin wrote:
> There is something wrong with page fault counter in mm/filemap.c, when 
> using madvise() with MADV_RANDOM flag set. Every page fault in this case 
> should be considered major, as it causes disk I/O. But in reality, 
> majflt/s in "sar -B" stays zero. I'm using 2.6.24 right now, but this 
> piece of code is identical in current kernel.
> The page is read into cache but no counter updated. The same applies 
> when kernel decides to disable read ahead due to excessive miss. 
> Furthermore, the code makes it possible to read ahead even with 
> MADV_RANDOM flag in some cases, as it loops from no_cached_page to 
> retry_find. And I am not sure, but does "no read ahead" really mean "no 
> page caching"?
> Please CC me if you want me to read your answer.

        /* If we don't want any read-ahead, don't bother */
        if (VM_RandomReadHint(vma))
                goto no_cached_page;

This blows past the only place in filemap_fault() where major faults
are accounted. You have spotted a bug, possibly even several. Major
fault accounting is missing from filemap_fault() in many cases beyond
just MADV_RANDOM. The gotos there are involved enough that it might
take me a few hours to come up with a patch. Maybe someone else who
works with the readahead affairs in there will finish it first.


-- wli

      reply	other threads:[~2009-02-04 22:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-04 12:09 Major page faults counter is zero with MADV_RANDOM Pavel Levshin
2009-02-04 22:38 ` wli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090204223836.GE10229@movementarian.org \
    --to=wli@movementarian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpk@581.spb.su \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox