mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: Andrew Morton <akpm@osdl.org>, Chris Wright <chrisw@osdl.org>,
	Linus Torvalds <torvalds@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Virtualization Mailing List <virtualization@lists.osdl.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	Martin Bligh <mbligh@mbligh.org>,
	Pratap Subrahmanyam <pratap@vmware.com>,
	Christopher Li <chrisl@vmware.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Ingo Molnar <mingo@elte.hu>, Zachary Amsden <zach@vmware.com>,
	Zachary Amsden <zach@vmware.com>
Subject: [PATCH 21/21] i386 Ldt context inline
Date: Mon, 7 Nov 2005 20:42:02 -0800	[thread overview]
Message-ID: <200511080442.jA84g2vH009964@zach-dev.vmware.com> (raw)

I was also able to get the LDT switching functionality out of the
critical path in switch_mm, which reduces the number of function calls,
potential TLB misses and code size.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Index: linux-2.6.14-zach-work/include/asm-i386/desc.h
===================================================================
--- linux-2.6.14-zach-work.orig/include/asm-i386/desc.h	2005-11-05 02:30:35.000000000 -0800
+++ linux-2.6.14-zach-work/include/asm-i386/desc.h	2005-11-05 02:32:51.000000000 -0800
@@ -271,6 +271,9 @@ static inline void restore_bios_segments
 	put_cpu();
 }
 
+extern void destroy_ldt(mm_context_t *pc);
+extern int copy_ldt(mm_context_t *new, mm_context_t *old);
+
 #endif /* !__ASSEMBLY__ */
 
 #endif
Index: linux-2.6.14-zach-work/include/asm-i386/mmu_context.h
===================================================================
--- linux-2.6.14-zach-work.orig/include/asm-i386/mmu_context.h	2005-11-05 02:30:35.000000000 -0800
+++ linux-2.6.14-zach-work/include/asm-i386/mmu_context.h	2005-11-05 02:32:51.000000000 -0800
@@ -10,9 +10,28 @@
 /*
  * Used for LDT copy/destruction.
  */
-int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
-void destroy_context(struct mm_struct *mm);
+static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
+{
+	struct mm_struct * old_mm;
+	int retval = 0;
+
+	memset(&mm->context, 0, sizeof(mm->context));
+	init_MUTEX(&mm->context.sem);
+	old_mm = current->mm;
+	if (old_mm && unlikely(old_mm->context.ldt)) {
+		retval = copy_ldt(&mm->context, &old_mm->context);
+	}
+	return retval;
+}
 
+/*
+ * No need to lock the MM as we are the last user
+ */
+static inline void destroy_context(struct mm_struct *mm)
+{
+	if (unlikely(mm->context.ldt))
+		destroy_ldt(&mm->context);
+}
 
 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 {
Index: linux-2.6.14-zach-work/arch/i386/kernel/ldt.c
===================================================================
--- linux-2.6.14-zach-work.orig/arch/i386/kernel/ldt.c	2005-11-05 02:32:28.000000000 -0800
+++ linux-2.6.14-zach-work/arch/i386/kernel/ldt.c	2005-11-05 02:33:24.000000000 -0800
@@ -103,29 +103,6 @@ void destroy_ldt(mm_context_t *pc)
 	pc->ldt = NULL;
 }
 
-int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
-{
-	struct mm_struct * old_mm;
-	int retval = 0;
-
-	memset(&mm->context, 0, sizeof(mm->context));
-	init_MUTEX(&mm->context.sem);
-	old_mm = current->mm;
-	if (old_mm && unlikely(old_mm->context.ldt)) {
-		retval = copy_ldt(&mm->context, &old_mm->context);
-	}
-	return retval;
-}
-
-/*
- * No need to lock the MM as we are the last user
- */
-void destroy_context(struct mm_struct *mm)
-{
-	if (unlikely(mm->context.ldt))
-		destroy_ldt(&mm->context);
-}
-
 static int read_ldt(void __user * ptr, unsigned long bytecount)
 {
 	int err;

             reply	other threads:[~2005-11-08  4:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-08  4:42 Zachary Amsden [this message]
2005-11-08  7:46 ` Ingo Molnar
2005-11-10 14:11 ` Andi Kleen

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=200511080442.jA84g2vH009964@zach-dev.vmware.com \
    --to=zach@vmware.com \
    --cc=akpm@osdl.org \
    --cc=chrisl@vmware.com \
    --cc=chrisw@osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@mbligh.org \
    --cc=mingo@elte.hu \
    --cc=pratap@vmware.com \
    --cc=torvalds@osdl.org \
    --cc=virtualization@lists.osdl.org \
    --cc=zwane@arm.linux.org.uk \
    /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