The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] vm: mlock superfluous variable
@ 2005-02-25  0:43 Darren Hart
  2005-02-25 17:11 ` Chris Wright
  0 siblings, 1 reply; 11+ messages in thread
From: Darren Hart @ 2005-02-25  0:43 UTC (permalink / raw)
  To: lkml, 

[-- 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;

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-02-28 20:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-25  0:43 [PATCH] vm: mlock superfluous variable Darren Hart
2005-02-25 17:11 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox