* Trouble with for_each_process(p) funciton
@ 2004-01-28 0:39 Joseph D. Wagner
0 siblings, 0 replies; only message in thread
From: Joseph D. Wagner @ 2004-01-28 0:39 UTC (permalink / raw)
To: linux-kernel
I'm doing some analysis of various memory management tequiniques and
allocation algorithims. I'm trying to edit the sys_brk function in mmap.c.
I added the following function to mmap.c and the appropriate function call
in the sys_brk function immediately after set_brk:.
static inline void decrement_prealloc_pages(void)
{
struct task_struct *p;
for_each_process(p)
{
p->mm->prealloc_pages = 0;
}
}
Everything works OK without the line:
p->mm->prealloc_pages = 0;
which doesn't make any sense to me because it's only an assignment.
A similar line directly in the sys_brk function:
mm->prealloc_pages |= 0x80;
works just fine, but I'm not trying to use that assignment on every process,
just the current one.
I tried all sorts of hacks to get it to work including checking for NULL,
&init_task, and a counter to prevent an infinite loop. Nothing helps. The
kernel always stops just before INIT when the last line is "Freed xKB of
kernel memory" (or something like that). If someone could help me figure
out what I'm doing wrong I'd appreciate it greatly.
FYI: prealloc_pages is an unsigned char that I added to the struct
mm_struct.
TIA.
Joseph D. Wagner
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-01-28 0:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-28 0:39 Trouble with for_each_process(p) funciton Joseph D. Wagner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®