lkml.org 
[lkml]   [1998]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Strange interrupt behaviour


On Wed, 15 Jul 1998, Gerard Roudier wrote:
>
> If you aren't convinced at this point, then you are probably unconvincible
> at the moment.

Feel free to try this, which is what I currently have in the i386
process.c (you need to change the header files to reflect this change
too).

This essentially keeps a few task-structs around for low memory
situations, and should work very well in a "steady-state" situation where
usually processes die at roughly the same rate as they get created. I
suspect it makes the problem go away at a very low cost, but I haven't
tested it on a low-lemory machine (or a big-memory machine either, for
that matter - for all I know it won't even boot).

This is just cut-and-pasted for you to see the basic approach. It
essentially acts as a 8-buffer overflow/underflow system (or at least ment
to act that way modulo any bugs that I have introduced).

Linus

-----
/*
* Allocation and freeing of basic task resources.
*
* NOTE! The task struct and the stack go together
*
* The task structure is a two-page thing, and as such
* not reliable to allocate using the basic page alloc
* functions. We have a small cache of structures for
* when the allocations fail..
*
* This extra buffer essentially acts to make for less
* "jitter" in the allocations..
*/
#define EXTRA_TASK_STRUCT 16
static struct task_struct * task_struct_stack[EXTRA_TASK_STRUCT];
static int task_struct_stack_ptr = -1;
struct task_struct * alloc_task_struct(void)
{
int index;
struct task_struct *ret;
index = task_struct_stack_ptr;
if (index >= EXTRA_TASK_STRUCT/2)
goto use_cache;
ret = (struct task_struct *) __get_free_pages(GFP_KERNEL,1);
if (!ret) {
index = task_struct_stack_ptr;
if (index >= 0) {
use_cache:
ret = task_struct_stack[index];
task_struct_stack_ptr = index-1;
}
}
return ret;
}
void free_task_struct(struct task_struct *p)
{
int index = task_struct_stack_ptr+1;
if (index < EXTRA_TASK_STRUCT) {
task_struct_stack[index] = p;
task_struct_stack_ptr = index;
} else
free_pages((unsigned long) p, 1);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:43    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site