public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Lord <lkml@rtr.ca>
To: Badari Pulavarty <pbadari@gmail.com>
Cc: Arjan van de Ven <arjan@infradead.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.xx:  dirty pages never being sync'd to disk?
Date: Mon, 14 Nov 2005 12:15:18 -0500	[thread overview]
Message-ID: <4378C626.4030107@rtr.ca> (raw)
In-Reply-To: <1131987398.24066.7.camel@localhost.localdomain>

Badari Pulavarty wrote:
>
> Interesting. Since you have a very easy to reproduce case -
> can you write a program to do posix_fadvise(POSIX_FADV_DONTNEED)
> on those files in directory "t" and see what happens ?

Sure.  It appears to cause an immediate "sync" of the file data
to disk (lots of drive activity for a few seconds), and the Dirty
count from /proc/meminfo reduces correspondingly.

Oddly enough, the Dirty count didn't go all the way down, though.
Doing a "sync" or a second run of the program afterwards does
get the count down to zero immediately, without any significant I/O.

Strange.

#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>

int main (int argc, char *argv[])
{
         while (--argc > 0) {
                 int fd = open(*++argv, O_RDWR);
                 if (fd == -1) {
                         perror(*argv);
                 } else {
                         int posix_fadvise(int, off_t, off_t, int);
                         const int POSIX_FADV_DONTNEED = 4;
                         int rc = posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
                         if (rc == -1)
                                 perror(*argv);
                         close(fd);
                 }
         }
         return 0;
}

  reply	other threads:[~2005-11-14 17:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-14 15:30 2.6.xx: dirty pages never being sync'd to disk? Mark Lord
2005-11-14 15:35 ` Arjan van de Ven
2005-11-14 15:49   ` Mark Lord
2005-11-14 15:54     ` Mark Lord
2005-11-14 16:56     ` Badari Pulavarty
2005-11-14 17:15       ` Mark Lord [this message]
2005-11-14 17:38         ` Mark Lord
2005-11-14 17:44         ` Mark Lord
2005-11-14 17:51           ` Mark Lord

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=4378C626.4030107@rtr.ca \
    --to=lkml@rtr.ca \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbadari@gmail.com \
    /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