From: "Rajat Jain" <rajat.noida.india@gmail.com>
To: kernelnewbies <kernelnewbies@nl.linux.org>,
newbie <linux-newbie@vger.kernel.org>
Subject: kernel stack problem
Date: Wed, 4 Apr 2007 06:20:15 +0530 [thread overview]
Message-ID: <b115cb5f0704031750g52b68cc6ncdecd6f3f94afbdf@mail.gmail.com> (raw)
Hi List,
Recently I got into the problem that I think relates to the small size
of kernel stack. I had a function of the following form:
void func()
{
...
//Block1
{
struct huge_var x;
....
....
}
....
//Block2
{
struct huge_var y;
....
....
}
....
}
The above code resulted in stack overflow. I had an understanding that
since the scope of variables x & y are limited to their blocks only,
the space for them will be allocated and released when the block is
entered and exited respectively. And hence the kernel stack will not
overflow since both x and y will not occupy memory simultaneously (one
instance of the variable can easily fit in the kernel stack).
I solved this problem by having a single instance of struct huge_var
declared immediately at function begining and reusing it in both
blocks. But my question is when (and where) are the block scope
variable allocated? In my previous case, were the two variables
occupying two sperate memory areas simultaneously?
Ah, I understand that I should use kernel stack sparingly ... and will do so.
Thanks,
Rajat
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next reply other threads:[~2007-04-04 0:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-04 0:50 Rajat Jain [this message]
2007-04-04 0:57 ` kernel stack problem Fabiano Ramos
2007-04-04 1:51 ` John Anthony Kazos Jr.
2007-04-04 3:19 ` Fabiano Ramos
2007-04-04 3:25 ` Fabiano Ramos
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=b115cb5f0704031750g52b68cc6ncdecd6f3f94afbdf@mail.gmail.com \
--to=rajat.noida.india@gmail.com \
--cc=kernelnewbies@nl.linux.org \
--cc=linux-newbie@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.