From: "Luiz Fernando N. Capitulino" <lcapitulino@mandriva.com.br>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu
Subject: [PATCH] i386: convert mm_context_t semaphore to a mutex
Date: Fri, 3 Aug 2007 10:55:40 -0300 [thread overview]
Message-ID: <20070803105540.4f85ae09@localhost> (raw)
Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
---
arch/i386/kernel/i386_ksyms.c | 1 +
arch/i386/kernel/ldt.c | 14 +++++++-------
arch/i386/kernel/ptrace.c | 4 ++--
include/asm-i386/mmu.h | 4 ++--
4 files changed, 12 insertions(+), 11 deletions(-)
--- linux-2.6-lcpt.orig/arch/i386/kernel/ldt.c
+++ linux-2.6-lcpt/arch/i386/kernel/ldt.c
@@ -94,13 +94,13 @@ int init_new_context(struct task_struct
struct mm_struct * old_mm;
int retval = 0;
- init_MUTEX(&mm->context.sem);
+ mutex_init(&mm->context.lock);
mm->context.size = 0;
old_mm = current->mm;
if (old_mm && old_mm->context.size > 0) {
- down(&old_mm->context.sem);
+ mutex_lock(&old_mm->context.lock);
retval = copy_ldt(&mm->context, &old_mm->context);
- up(&old_mm->context.sem);
+ mutex_unlock(&old_mm->context.lock);
}
return retval;
}
@@ -132,7 +132,7 @@ static int read_ldt(void __user * ptr, u
if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES)
bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES;
- down(&mm->context.sem);
+ mutex_lock(&mm->context.lock);
size = mm->context.size*LDT_ENTRY_SIZE;
if (size > bytecount)
size = bytecount;
@@ -140,7 +140,7 @@ static int read_ldt(void __user * ptr, u
err = 0;
if (copy_to_user(ptr, mm->context.ldt, size))
err = -EFAULT;
- up(&mm->context.sem);
+ mutex_unlock(&mm->context.lock);
if (err < 0)
goto error_return;
if (size != bytecount) {
@@ -196,7 +196,7 @@ static int write_ldt(void __user * ptr,
goto out;
}
- down(&mm->context.sem);
+ mutex_lock(&mm->context.lock);
if (ldt_info.entry_number >= mm->context.size) {
error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1);
if (error < 0)
@@ -223,7 +223,7 @@ install:
error = 0;
out_unlock:
- up(&mm->context.sem);
+ mutex_unlock(&mm->context.lock);
out:
return error;
}
--- linux-2.6-lcpt.orig/arch/i386/kernel/ptrace.c
+++ linux-2.6-lcpt/arch/i386/kernel/ptrace.c
@@ -166,7 +166,7 @@ static unsigned long convert_eip_to_line
seg &= ~7UL;
- down(&child->mm->context.sem);
+ mutex_lock(&child->mm->context.lock);
if (unlikely((seg >> 3) >= child->mm->context.size))
addr = -1L; /* bogus selector, access would fault */
else {
@@ -180,7 +180,7 @@ static unsigned long convert_eip_to_line
addr &= 0xffff;
addr += base;
}
- up(&child->mm->context.sem);
+ mutex_unlock(&child->mm->context.lock);
}
return addr;
}
--- linux-2.6-lcpt.orig/include/asm-i386/mmu.h
+++ linux-2.6-lcpt/include/asm-i386/mmu.h
@@ -1,7 +1,7 @@
#ifndef __i386_MMU_H
#define __i386_MMU_H
-#include <asm/semaphore.h>
+#include <linux/mutex.h>
/*
* The i386 doesn't have a mmu context, but
* we put the segment information here.
@@ -10,7 +10,7 @@
*/
typedef struct {
int size;
- struct semaphore sem;
+ struct mutex lock;
void *ldt;
void *vdso;
} mm_context_t;
--- linux-2.6-lcpt.orig/arch/i386/kernel/i386_ksyms.c
+++ linux-2.6-lcpt/arch/i386/kernel/i386_ksyms.c
@@ -1,4 +1,5 @@
#include <linux/module.h>
+#include <asm/semaphore.h>
#include <asm/checksum.h>
#include <asm/desc.h>
--
Luiz Fernando N. Capitulino
next reply other threads:[~2007-08-03 13:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-03 13:55 Luiz Fernando N. Capitulino [this message]
2007-08-06 7:46 ` [PATCH] i386: convert mm_context_t semaphore to a mutex Ingo Molnar
2007-08-06 13:34 ` Luiz Fernando N. Capitulino
2007-08-06 13:36 ` Luiz Fernando N. Capitulino
2007-08-06 15:25 ` Ingo Molnar
2007-08-06 17:15 ` Luiz Fernando N. Capitulino
2007-08-06 17:43 ` Ingo Molnar
2007-08-06 19:32 ` Andi Kleen
2007-08-06 20:36 ` Luiz Fernando N. Capitulino
2007-08-06 13:36 ` Luiz Fernando N. Capitulino
2007-08-06 21:10 ` Luiz Fernando N. Capitulino
2007-08-06 13:39 ` Luiz Fernando N. Capitulino
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=20070803105540.4f85ae09@localhost \
--to=lcapitulino@mandriva.com.br \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.