linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chen Gang <xili_gchen_5257@hotmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	"oleg@redhat.com" <oleg@redhat.com>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	"dave@stgolabs.net" <dave@stgolabs.net>,
	"aarcange@redhat.com" <aarcange@redhat.com>
Cc: Linux Memory <linux-mm@kvack.org>,
	kernel mailing list <linux-kernel@vger.kernel.org>
Subject: [PATCH] mm/mmap.c: Remove redundant local variables for may_expand_vm()
Date: Tue, 10 Nov 2015 05:41:08 +0800	[thread overview]
Message-ID: <COL130-W65418E50E899195C9B2134B9150@phx.gbl> (raw)

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

>From 7050c267d8dda220226067039d815593d2f9a874 Mon Sep 17 00:00:00 2001
From: Chen Gang <gang.chen.5i5j@gmail.com>
Date: Tue, 10 Nov 2015 05:32:38 +0800
Subject: [PATCH] mm/mmap.c: Remove redundant local variables for may_expand_vm()

After merge the related code into one line, the code is still simple and
meaningful enough.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 mm/mmap.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 2ce04a6..a515260 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2988,12 +2988,7 @@ out:
  */
 int may_expand_vm(struct mm_struct *mm, unsigned long npages)
 {
-	unsigned long cur = mm->total_vm;	/* pages */
-	unsigned long lim;
-
-	lim = rlimit(RLIMIT_AS)>> PAGE_SHIFT;
-
-	if (cur + npages> lim)
+	if (mm->total_vm + npages> (rlimit(RLIMIT_AS)>> PAGE_SHIFT))
 		return 0;
 	return 1;
 }
-- 
1.9.3

 		 	   		  

[-- Attachment #2: 0001-mm-mmap.c-Remove-redundant-local-variables-for-may_e.patch --]
[-- Type: application/octet-stream, Size: 895 bytes --]

From 7050c267d8dda220226067039d815593d2f9a874 Mon Sep 17 00:00:00 2001
From: Chen Gang <gang.chen.5i5j@gmail.com>
Date: Tue, 10 Nov 2015 05:32:38 +0800
Subject: [PATCH] mm/mmap.c: Remove redundant local variables for may_expand_vm()

After merge the related code into one line, the code is still simple and
meaningful enough.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 mm/mmap.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 2ce04a6..a515260 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2988,12 +2988,7 @@ out:
  */
 int may_expand_vm(struct mm_struct *mm, unsigned long npages)
 {
-	unsigned long cur = mm->total_vm;	/* pages */
-	unsigned long lim;
-
-	lim = rlimit(RLIMIT_AS) >> PAGE_SHIFT;
-
-	if (cur + npages > lim)
+	if (mm->total_vm + npages > (rlimit(RLIMIT_AS) >> PAGE_SHIFT))
 		return 0;
 	return 1;
 }
-- 
1.9.3


             reply	other threads:[~2015-11-09 21:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09 21:41 Chen Gang [this message]
2015-11-10  1:39 ` Naoya Horiguchi
2015-11-10 22:22   ` Chen Gang
2015-11-10 22:40 ` Chen Gang

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=COL130-W65418E50E899195C9B2134B9150@phx.gbl \
    --to=xili_gchen_5257@hotmail.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave@stgolabs.net \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oleg@redhat.com \
    /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