From: Zachary Amsden <zach@vmware.com>
To: Chuck Ebbert <76306.1226@compuserve.com>,
Chris Wright <chrisw@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
virtualization@lists.osdl.org,
Pratap Subrahmanyam <pratap@vmware.com>
Subject: Re: [PATCH 3/6] i386 virtualization - Make ldt a desc struct
Date: Tue, 16 Aug 2005 11:44:15 -0700 [thread overview]
Message-ID: <430233FF.7090106@vmware.com> (raw)
In-Reply-To: <200508161306_MC3-1-A75D-6646@compuserve.com>
[-- Attachment #1: Type: text/plain, Size: 808 bytes --]
Chuck Ebbert wrote:
>
>>@@ -97,14 +96,16 @@
>>
>> void destroy_ldt(struct mm_struct *mm)
>> {
>>+ int pages = mm->context.ldt_pages;
>>+
>> if (mm == current->active_mm)
>> clear_LDT();
>>- ClearPagesLDT(mm->context.ldt, (mm->context.size * LDT_ENTRY_SIZE) / PAGE_SIZE);
>>- if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
>>+ ClearPagesLDT(mm->context.ldt, pages);
>>+ if (pages > 1)
>> vfree(mm->context.ldt);
>> else
>> kfree(mm->context.ldt);
>>- mm->context.size = 0;
>>+ mm->context.ldt_pages = 0; <====================
>> }
>>
>> static int read_ldt(void __user * ptr, unsigned long bytecount)
>>
>>
>
> destroy_ldt does not zero "ldt", just the size. Potential bug?
>
>
Not a bug, truly unnecessary at all.
[-- Attachment #2: remove-useless-zeroing --]
[-- Type: text/plain, Size: 1231 bytes --]
Several reviewers noticed that initialization and destruction of the
mm->context is unnecessary, since the entire MM struct is zeroed on
allocation anyways.
Verified with BUG_ON(mm->context.ldt || mm->context.ldt_pages);
Signed-off-by: Zachary Amsden <zach@vmware.com>
Index: linux-2.6.13/include/asm-i386/mmu_context.h
===================================================================
--- linux-2.6.13.orig/include/asm-i386/mmu_context.h 2005-08-15 11:23:32.000000000 -0700
+++ linux-2.6.13/include/asm-i386/mmu_context.h 2005-08-16 11:35:11.000000000 -0700
@@ -16,7 +16,6 @@
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)) {
Index: linux-2.6.13/arch/i386/kernel/ldt.c
===================================================================
--- linux-2.6.13.orig/arch/i386/kernel/ldt.c 2005-08-15 11:23:32.000000000 -0700
+++ linux-2.6.13/arch/i386/kernel/ldt.c 2005-08-16 11:12:59.000000000 -0700
@@ -105,7 +105,6 @@
vfree(mm->context.ldt);
else
kfree(mm->context.ldt);
- mm->context.ldt_pages = 0;
}
static int read_ldt(void __user * ptr, unsigned long bytecount)
next prev parent reply other threads:[~2005-08-16 18:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-16 17:03 [PATCH 3/6] i386 virtualization - Make ldt a desc struct Chuck Ebbert
2005-08-16 18:44 ` Zachary Amsden [this message]
2005-08-16 19:05 ` [PATCH] i386 / desc_empty macro is incorrect Chris Wright
2005-08-16 19:18 ` Linus Torvalds
2005-08-16 20:41 ` [PATCH 3/6] i386 virtualization - Make ldt a desc struct Chris Wright
2005-08-16 20:56 ` Zachary Amsden
-- strict thread matches above, loose matches on Subject: below --
2005-08-15 22:59 zach
2005-08-16 5:23 ` Chris Wright
2005-08-16 5:46 ` Zachary Amsden
2005-08-16 6:17 ` Chris Wright
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=430233FF.7090106@vmware.com \
--to=zach@vmware.com \
--cc=76306.1226@compuserve.com \
--cc=akpm@osdl.org \
--cc=chrisw@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pratap@vmware.com \
--cc=virtualization@lists.osdl.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