Re: madvise(2) MADV_SEQUENTIAL behavior

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Chris Snook <csnook@...>
Cc: Rik van Riel <riel@...>, Peter Zijlstra <peterz@...>, <linux-kernel@...>, linux-mm <linux-mm@...>, Andrew Morton <akpm@...>, Nick Piggin <nickpiggin@...>
Date: Wednesday, July 16, 2008 - 8:01 pm

On Wed, 2008-07-16 at 17:05 -0400, Chris Snook wrote:

This approach, instead of invalidating the pages right away would
provide a middle ground: a way to tell the kernel "these pages are not
too important".

Whereas if MADV_SEQUENTIAL just invalidates the pages once per megabyte
(say), then it's only doing what is already possible using MADV_DONTNEED
("drop this pages now"). It would automate the process, but it would not
provide a more subtle hint, which could be quite useful.

As I see it, there are two basic concepts here:
- no_reuse (like FADV_NOREUSE)
- more_ra (more readahead)
(DONTNEED being another different concept)

Then:
MADV_SEQUENTIAL = more_ra | no_reuse
FADV_SEQUENTIAL = more_ra | no_reuse
FADV_NOREUSE = no_reuse

Right now, only the 'more_ra' part is implemented. 'no_reuse' could be
implemented as Chris suggests.

It looks like the disagreement a year ago around Peter's approach was
mostly around the question of whether using read ahead as a heuristic
for "drop behind" was safe for all workloads.

Would it be less controversial to remove the heuristic (ra->size ==
ra->ra_pages), and to do something only if the user asked for
_SEQUENTIAL or _NOREUSE?

It might encourage user space applications to start using
FADV_SEQUENTIAL or FADV_NOREUSE more often (as it would become
worthwhile to do so), and if they do (especially cron jobs), the problem
of the slow desktop in the morning would progressively solve itself.

Thanks.

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
madvise(2) MADV_SEQUENTIAL behavior, Eric Rannaud, (Tue Jul 15, 7:03 pm)
Re: madvise(2) MADV_SEQUENTIAL behavior, Peter Zijlstra, (Wed Jul 16, 8:14 am)
Re: madvise(2) MADV_SEQUENTIAL behavior, Rik van Riel, (Wed Jul 16, 10:50 am)
Re: madvise(2) MADV_SEQUENTIAL behavior, Chris Snook, (Wed Jul 16, 5:05 pm)
Re: madvise(2) MADV_SEQUENTIAL behavior, Rik van Riel, (Thu Jul 17, 10:20 am)
Re: madvise(2) MADV_SEQUENTIAL behavior, Eric Rannaud, (Wed Jul 16, 8:01 pm)
Re: madvise(2) MADV_SEQUENTIAL behavior, Nick Piggin, (Thu Jul 17, 2:14 am)
Re: madvise(2) MADV_SEQUENTIAL behavior, Rik van Riel, (Thu Jul 17, 10:21 am)
Re: madvise(2) MADV_SEQUENTIAL behavior, Chris Snook, (Thu Jul 17, 2:04 pm)
Re: madvise(2) MADV_SEQUENTIAL behavior, Peter Zijlstra, (Thu Jul 17, 2:09 pm)