From: "Manfred Spraul" <manfred@colorfullife.com>
To: "Davide Libenzi" <davidel@xmailserver.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] task_struct colouring ...
Date: Sat, 1 Dec 2001 11:17:25 +0100 [thread overview]
Message-ID: <000901c17a51$62526070$010411ac@local> (raw)
>
> 2) Code clarity
>
I really liked Ben's idea of an include file with macros for asm access to the current pointer.
That was a major improvement for the code clarity. IMHO a patch that changes current
should introduce such a file.
> unsigned long tskb = __get_free_pages(GFP_KERNEL, 1), tsk;
> tsk = tskb | ((tskb >> 13) & 0x00000060) | SMP_CACHE_BYTES;
> *(unsigned long *) tskb = tsk;
You only colour 2 bits (offset 32, 64 or 96 - all within one cacheline on P 4) - I doubt that this
helps a lot. And you do not colour the stack top - all processes sleeping in accept() will still
have their wait queues at the same cache colour. And if you use more bits, you risk
stack overflows.
Which means there are only 2 options for the memory allocation:
- split stack and task structure into 2 independant parts. task struct from slab, stack
8 kB-colouring.
- switch to 16 kB allocations for stack+task, and then colour both stack and task
structure.
There are obviously lots of alternatives how to look up the task structure address:
* bottom of stack allocation (your patch)
* %cr2 (broken, only works for OS' that never cause page faults such as Netware)
* gs: (segment register, x86-64 uses that. But i386 doesn't have the swapgs instruction)
* str (Ben's patch)
* read from local apic memory (real slow!, uncached memory reference)
> More, in finding the pointer directly at the base (SP & ~8191UL) makes it
> easy for external programs ( ie gdb ) to seek the task_struct w/out
> knowing the internal math that created it.
Is that a realistic problem? Usually you want to go from task struct to the stack, not the other
way around.
--
Manfred
next reply other threads:[~2001-12-01 10:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-01 10:17 Manfred Spraul [this message]
2001-12-01 21:49 ` [PATCH] task_struct colouring Davide Libenzi
2001-12-01 22:04 ` H. Peter Anvin
-- strict thread matches above, loose matches on Subject: below --
2001-11-30 21:47 Davide Libenzi
2001-11-30 22:40 ` Alan Cox
2001-11-30 23:37 ` H. Peter Anvin
2001-11-30 23:53 ` Davide Libenzi
2001-11-30 23:57 ` Alan Cox
2001-12-01 0:33 ` Davide Libenzi
2001-12-01 1:05 ` H. Peter Anvin
2001-12-01 1:30 ` Davide Libenzi
2001-12-01 1:24 ` H. Peter Anvin
2001-12-01 1:41 ` Davide Libenzi
2001-12-01 1:36 ` H. Peter Anvin
2001-12-01 9:58 ` Alan Cox
2001-12-01 9:49 ` Alan Cox
2001-12-01 23:37 ` Davide Libenzi
2001-12-01 23:50 ` kumon
2001-12-02 0:11 ` Davide Libenzi
2001-12-02 16:39 ` Alan Cox
2001-12-02 0:02 ` [MOc]cda*mirabilos
2001-12-02 0:56 ` Davide Libenzi
2001-12-02 15:06 ` [MOc]cda*mirabilos
2001-12-02 19:49 ` Davide Libenzi
2001-12-02 19:50 ` Thorsten Glaser
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='000901c17a51$62526070$010411ac@local' \
--to=manfred@colorfullife.com \
--cc=davidel@xmailserver.org \
--cc=linux-kernel@vger.kernel.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