From: "Joseph D. Wagner" <theman@josephdwagner.info>
To: linux-kernel@vger.kernel.org
Subject: Trouble with for_each_process(p) funciton
Date: Tue, 27 Jan 2004 18:39:42 -0600 [thread overview]
Message-ID: <200401271839.42873.theman@josephdwagner.info> (raw)
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
reply other threads:[~2004-01-28 0:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200401271839.42873.theman@josephdwagner.info \
--to=theman@josephdwagner.info \
--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
all inboxes | Powered by JetHome®