Messages in this thread | | | Date | Tue, 21 Sep 1999 01:39:21 -0400 (EDT) | From | Chuck Lever <> | Subject | Re: [patch] readahead must be stopped when OOM |
| |
On Mon, 20 Sep 1999, Andrea Arcangeli wrote: > This is a part of my new oom-patch updated to 2.3.18ac6: > > diff -urN 2.3.18ac6/mm/filemap.c 2.3.18ac6-oom/mm/filemap.c > --- 2.3.18ac6/mm/filemap.c Mon Sep 20 01:15:46 1999 > +++ 2.3.18ac6-oom/mm/filemap.c Mon Sep 20 02:42:38 1999 > @@ -923,7 +923,8 @@ > ahead = 0; > while (ahead < max_ahead) { > ahead += PAGE_CACHE_SIZE; > - page_cache_read(filp, raend + ahead); > + if (page_cache_read(filp, raend + ahead) < 0) > + break; > } > /* > * If we tried to read ahead some pages, > > > The above was missing from the filemap.c oom fixes in 2.3.18ac6.
this loop needs to stop before going past the end of the file. changing the "while" this way seems to be effective, and restores previous good behavior.
while ((ahead < max_ahead) && (raend + ahead + PAGE_CACHE_SIZE < inode->i_size)) {
but this loop is weird because it has subtle side-effects on "ahead". i think it should be OK to break the loop due to oom/i-o errors without causing the read-ahead behavior to break badly.
- Chuck Lever -- corporate: <chuckl@netscape.com> personal: <chucklever@netscape.net> or <cel@monkey.org>
The Linux Scalability project: http://www.citi.umich.edu/projects/linux-scalability/
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |