The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Darren Hart <dvhltc@us.ibm.com>
To: "lkml, " <linux-kernel@vger.kernel.org>
Subject: [PATCH] vm: mlock superfluous variable
Date: Thu, 24 Feb 2005 16:43:33 -0800	[thread overview]
Message-ID: <421E74B5.3040701@us.ibm.com> (raw)

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

The were a couple long standing (since at least 2.4.21) superfluous 
variables and two unnecessary assignments in do_mlock().  The intent of 
the resulting code is also more obvious.

Tested on a 4 way x86 box running a simple mlock test program.  No 
problems detected.

Signed-off-by: Darren Hart <dvhltc@us.ibm.com>n

[-- Attachment #2: mlock --]
[-- Type: text/plain, Size: 948 bytes --]

diff -purN -X /home/dvhart/.diff.exclude /home/linux/views/linux-2.6.11-rc5/mm/mlock.c 2.6.11-rc5-mlock/mm/mlock.c
--- /home/linux/views/linux-2.6.11-rc5/mm/mlock.c	2004-12-24 15:26:12.000000000 -0800
+++ 2.6.11-rc5-mlock/mm/mlock.c	2005-02-24 13:57:38.000000000 -0800
@@ -58,8 +58,8 @@ out:
 
 static int do_mlock(unsigned long start, size_t len, int on)
 {
-	unsigned long nstart, end, tmp;
-	struct vm_area_struct * vma, * next;
+	unsigned long nstart, end;
+	struct vm_area_struct * vma;
 	int error;
 
 	len = PAGE_ALIGN(len);
@@ -86,13 +86,11 @@ static int do_mlock(unsigned long start,
 			break;
 		}
 
-		tmp = vma->vm_end;
-		next = vma->vm_next;
-		error = mlock_fixup(vma, nstart, tmp, newflags);
+		error = mlock_fixup(vma, nstart, vma->vm_end, newflags);
 		if (error)
 			break;
-		nstart = tmp;
-		vma = next;
+		nstart = vma->vm_end;
+		vma = vma->vm_next;
 		if (!vma || vma->vm_start != nstart) {
 			error = -ENOMEM;
 			break;

             reply	other threads:[~2005-02-25  0:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-25  0:43 Darren Hart [this message]
2005-02-25 17:11 ` [PATCH] vm: mlock superfluous variable Chris Wright
2005-02-25 22:05   ` [PATCH] allow vma merging with mlock et. al Chris Wright
2005-02-25 22:26     ` Darren Hart
2005-02-25 23:38       ` Chris Wright
2005-02-26  0:56         ` Andrea Arcangeli
2005-02-26  1:13           ` Chris Wright
2005-02-26 17:20     ` Hugh Dickins
2005-02-28 20:33       ` Chris Wright
2005-02-28 20:53         ` Hugh Dickins
2005-02-25 22:21   ` [PATCH] vm: mlock superfluous variable Darren Hart

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=421E74B5.3040701@us.ibm.com \
    --to=dvhltc@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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