linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] 2.4's sys_readahead is borked
@ 2004-02-04  0:19 Robert Love
  2004-02-04 14:30 ` Marcelo Tosatti
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Love @ 2004-02-04  0:19 UTC (permalink / raw)
  To: marcelo.tosatti; +Cc: linux-kernel

In 2.4, sys_readahead() performs readahead against a maximum of half the
number of inactive pages.  This is dumb, as it ignores the number of
free pages completely.  Worse, in certain situations, such as boot, the
inactive list can be quite small and the free list quite large, but
readahead(2) won't do anything.

The right thing to do is limit sys_readahead() to a maximum of half of
the sum of the number of free pages and inactive pages, which is what
2.6 does.

Attached patch is against 2.4.25-pre8.  Please apply.

	Robert Love

 mm/filemap.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -urN linux-2.4.25-pre8/mm/filemap.c.orig linux-2.4.25-pre8/mm/filemap.c
--- linux-2.4.25-pre8/mm/filemap.c.orig	2004-02-03 19:13:33.540115456 -0500
+++ linux-2.4.25-pre8/mm/filemap.c	2004-02-03 19:13:49.468693944 -0500
@@ -1965,7 +1965,7 @@
 		nr = max;
 
 	/* And limit it to a sane percentage of the inactive list.. */
-	max = nr_inactive_pages / 2;
+	max = (nr_free_pages() + nr_inactive_pages) / 2;
 	if (nr > max)
 		nr = max;
 


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

* Re: [patch] 2.4's sys_readahead is borked
  2004-02-04  0:19 [patch] 2.4's sys_readahead is borked Robert Love
@ 2004-02-04 14:30 ` Marcelo Tosatti
  2004-02-04 15:20   ` Robert Love
  2004-02-07  9:14   ` Arjan van de Ven
  0 siblings, 2 replies; 6+ messages in thread
From: Marcelo Tosatti @ 2004-02-04 14:30 UTC (permalink / raw)
  To: Robert Love; +Cc: marcelo.tosatti, linux-kernel



On Tue, 3 Feb 2004, Robert Love wrote:

> In 2.4, sys_readahead() performs readahead against a maximum of half the
> number of inactive pages.  This is dumb, as it ignores the number of
> free pages completely.  Worse, in certain situations, such as boot, the
> inactive list can be quite small and the free list quite large, but
> readahead(2) won't do anything.
>
> The right thing to do is limit sys_readahead() to a maximum of half of
> the sum of the number of free pages and inactive pages, which is what
> 2.6 does.

Hi Robert,

This looks okay, applied.

Question: Do you know any user of sys_readahead() ?


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

* Re: [patch] 2.4's sys_readahead is borked
  2004-02-04 14:30 ` Marcelo Tosatti
@ 2004-02-04 15:20   ` Robert Love
  2004-02-04 18:42     ` Mike Fedyk
  2004-02-07  9:14   ` Arjan van de Ven
  1 sibling, 1 reply; 6+ messages in thread
From: Robert Love @ 2004-02-04 15:20 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-kernel

On Wed, 2004-02-04 at 12:30 -0200, Marcelo Tosatti wrote:

Hi, Marcelo.

> Hi Robert,
> 
> This looks okay, applied.

Thanks!

> Question: Do you know any user of sys_readahead() ?

Not really - I've been playing with it.  But OpenOffice just added it to
preload some of their libraries.  It should probably be deprecated and
remove in 2.7, since posix_fadvise(POSIX_FADV_WILLNEED) does this same
thing.

	Robert Love



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

* Re: [patch] 2.4's sys_readahead is borked
  2004-02-04 15:20   ` Robert Love
@ 2004-02-04 18:42     ` Mike Fedyk
  2004-02-04 18:47       ` Robert Love
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Fedyk @ 2004-02-04 18:42 UTC (permalink / raw)
  To: Robert Love; +Cc: Marcelo Tosatti, linux-kernel

Robert Love wrote:
> On Wed, 2004-02-04 at 12:30 -0200, Marcelo Tosatti wrote:
>>Question: Do you know any user of sys_readahead() ?
> 
> 
> Not really - I've been playing with it.  But OpenOffice just added it to
> preload some of their libraries.  It should probably be deprecated and
> remove in 2.7, since posix_fadvise(POSIX_FADV_WILLNEED) does this same
> thing.

In 2.4 also?

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

* Re: [patch] 2.4's sys_readahead is borked
  2004-02-04 18:42     ` Mike Fedyk
@ 2004-02-04 18:47       ` Robert Love
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Love @ 2004-02-04 18:47 UTC (permalink / raw)
  To: Mike Fedyk; +Cc: Marcelo Tosatti, linux-kernel

On Wed, 2004-02-04 at 10:42 -0800, Mike Fedyk wrote:

> Robert Love wrote:
>
> > Not really - I've been playing with it.  But OpenOffice just added it to
> > preload some of their libraries.  It should probably be deprecated and
> > remove in 2.7, since posix_fadvise(POSIX_FADV_WILLNEED) does this same
> > thing.
> 
> In 2.4 also?

No, posix_fadvise() is only in 2.6.

So we deprecate readahead() in 2.7...

	Robert Love



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

* Re: [patch] 2.4's sys_readahead is borked
  2004-02-04 14:30 ` Marcelo Tosatti
  2004-02-04 15:20   ` Robert Love
@ 2004-02-07  9:14   ` Arjan van de Ven
  1 sibling, 0 replies; 6+ messages in thread
From: Arjan van de Ven @ 2004-02-07  9:14 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Robert Love, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

On Wed, 2004-02-04 at 09:30, Marcelo Tosatti wrote:

> 
> Question: Do you know any user of sys_readahead() ?

Development versions of Fedora will sys_readahead a bunch of stuff
during system boot to avoid disk IO (and seeks) later on. The plan is to
expand this further from the current code (eg readahead stuff while dhcp
is trying to get an address and the disk is idle, etc etc).



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2004-02-08 10:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-04  0:19 [patch] 2.4's sys_readahead is borked Robert Love
2004-02-04 14:30 ` Marcelo Tosatti
2004-02-04 15:20   ` Robert Love
2004-02-04 18:42     ` Mike Fedyk
2004-02-04 18:47       ` Robert Love
2004-02-07  9:14   ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).