[TRIVIAL PATCH 2.5.50] madvise_willneed makes bad limit comparison

Kingsley Cheung (kingsley@aurema.com)
Mon, 9 Dec 2002 15:53:16 +1100


Hi,

Trivial patch against 2.5.50, similar to the patch I sent earlier for
2.4.20, to fix the bad rss limit comparision in 'madvise_willneed'.

diff -urN linux-2.5.50/mm/madvise.c linux-2.5.50patched/mm/madvise.c
--- linux-2.5.50/mm/madvise.c Thu Nov 28 09:35:53 2002
+++ linux-2.5.50patched/mm/madvise.c Mon Dec 9 15:20:48 2002
@@ -75,10 +75,12 @@

/* Make sure this doesn't exceed the process's max rss. */
error = -EIO;
- rlim_rss = current->rlim ? current->rlim[RLIMIT_RSS].rlim_cur :
- LONG_MAX; /* default: see resource.h */
- if ((vma->vm_mm->rss + (end - start)) > rlim_rss)
- return error;
+ rlim_rss = current->rlim[RLIMIT_RSS].rlim_cur;
+ if (rlim_rss != RLIM_INFINITY) {
+ rlim_rss >>= PAGE_SHIFT;
+ if ((vma->vm_mm->rss + (end - start)) > rlim_rss)
+ return error;
+ }

do_page_cache_readahead(file->f_dentry->d_inode->i_mapping, file, start, end - start);
return 0;

-- 
		Kingsley
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/