* [PATCH] x86: cleanup - eliminate numbers in LDT allocation code
@ 2008-02-01 17:14 Cyrill Gorcunov
2008-02-01 17:18 ` Ingo Molnar
0 siblings, 1 reply; 3+ messages in thread
From: Cyrill Gorcunov @ 2008-02-01 17:14 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Thomas Gleixner, Andi Kleen, H. Peter Anvin, LKML
This patch eliminates numbers in LDT allocation code
trying to make it clear to understand from where
these numbers are go
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
I hope nobody shoot me ;)
Index: linux-2.6.git/arch/x86/kernel/ldt.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/ldt.c 2008-02-01 19:30:01.000000000 +0300
+++ linux-2.6.git/arch/x86/kernel/ldt.c 2008-02-01 19:38:32.000000000 +0300
@@ -35,7 +35,8 @@ static int alloc_ldt(mm_context_t *pc, i
if (mincount <= pc->size)
return 0;
oldsize = pc->size;
- mincount = (mincount + 511) & (~511);
+ mincount = (mincount + (PAGE_SIZE / LDT_ENTRY_SIZE - 1)) &
+ (~(PAGE_SIZE / LDT_ENTRY_SIZE - 1));
if (mincount * LDT_ENTRY_SIZE > PAGE_SIZE)
newldt = vmalloc(mincount * LDT_ENTRY_SIZE);
else
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: cleanup - eliminate numbers in LDT allocation code
2008-02-01 17:14 [PATCH] x86: cleanup - eliminate numbers in LDT allocation code Cyrill Gorcunov
@ 2008-02-01 17:18 ` Ingo Molnar
2008-02-01 17:27 ` Cyrill Gorcunov
0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2008-02-01 17:18 UTC (permalink / raw)
To: Cyrill Gorcunov; +Cc: Thomas Gleixner, Andi Kleen, H. Peter Anvin, LKML
* Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> This patch eliminates numbers in LDT allocation code trying to make it
> clear to understand from where these numbers are go
thanks, applied.
> I hope nobody shoot me ;)
nope, magic constants are bad in general.
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: cleanup - eliminate numbers in LDT allocation code
2008-02-01 17:18 ` Ingo Molnar
@ 2008-02-01 17:27 ` Cyrill Gorcunov
0 siblings, 0 replies; 3+ messages in thread
From: Cyrill Gorcunov @ 2008-02-01 17:27 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Thomas Gleixner, Andi Kleen, H. Peter Anvin, LKML
[Ingo Molnar - Fri, Feb 01, 2008 at 06:18:26PM +0100]
|
| * Cyrill Gorcunov <gorcunov@gmail.com> wrote:
|
| > This patch eliminates numbers in LDT allocation code trying to make it
| > clear to understand from where these numbers are go
|
| thanks, applied.
|
| > I hope nobody shoot me ;)
|
| nope, magic constants are bad in general.
|
| Ingo
|
Thanks Ingo, and really thanks to Andi for his
explanation on this case.
- Cyrill -
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-02-01 17:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-01 17:14 [PATCH] x86: cleanup - eliminate numbers in LDT allocation code Cyrill Gorcunov
2008-02-01 17:18 ` Ingo Molnar
2008-02-01 17:27 ` Cyrill Gorcunov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox