[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble with for_each_process(p) funciton


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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo _at_ vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


この情報があなたの探していたものかどうか選択してください。
yes/まさにこれだ!   no/違うなぁ   part/一部見つかった   try/これで試してみる

あなたが探していた情報はどのようなことか、ご自由に記入下さい。特に「まさにこれだ!」と言う場合は記入をお願いします。
例:「複数のマシンからCATV経由でipmasqueradeを利用してWebを参照したい場合の設定について」