mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kingsley Cheung <kingsley@aurema.com>
To: linux-kernel@vger.kernel.org
Cc: trivial@rustcorp.com.au
Subject: [TRIVIAL PATCH 2.5.50] madvise_willneed makes bad limit comparison
Date: Mon, 9 Dec 2002 15:53:16 +1100	[thread overview]
Message-ID: <20021209155316.E12270@aurema.com> (raw)
In-Reply-To: <20021209150426.D12270@aurema.com>; from kingsley@aurema.com on Mon, Dec 09, 2002 at 03:04:26PM +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

  reply	other threads:[~2002-12-09  4:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-09  4:04 [TRIVIAL PATCH 2.4.20] " Kingsley Cheung
2002-12-09  4:53 ` Kingsley Cheung [this message]
2002-12-09  6:29 ` Andrew Morton
2002-12-10  6:08   ` Kingsley Cheung
2002-12-10  7:55     ` Andrew Morton
2002-12-09 19:27 ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021209155316.E12270@aurema.com \
    --to=kingsley@aurema.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trivial@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome