Re: ~500 megs cached yet 2.6.5 goes into swap hell

Andrew Morton
2004-04-30T08:03:07Z

Jeff Garzik <jgarzik@pobox.com> wrote:
>
> > fadvise(POSIX_FADV_DONTNEED) is ideal for this. Run it once per megabyte
> > or so.
>
>
> Sweet. I'm so happy you added posix_fadvise (way back when), and even
> happier to hear this.

There are a number of other goodies we could add to it, as linux
extensions.

> Does our fadvise support len==0 ("I mean the whole file")? That's
> defined in POSIX, and would allow a compliant app to simply
> POSIX_FADV_DONTNEED once at the beginning.

Well I'll be darned.

--- 25/mm/fadvise.c~fadvise-len-fix 2004-04-30 00:58:00.437598504 -0700
+++ 25-akpm/mm/fadvise.c 2004-04-30 00:59:03.237051536 -0700
@@ -38,6 +38,9 @@ asmlinkage long sys_fadvise64_64(int fd,
goto out;
}

+ if (len == 0) /* 0 == "all data following offset" */
+ len = -1;
+
bdi = mapping->backing_dev_info;

switch (advice) {

_