From: kanoj@google.engr.sgi.com (Kanoj Sarcar)
To: axanth@tee.gr
Cc: linux-mm@kvack.org
Subject: Re: Shrinking stack
Date: Wed, 8 Mar 2000 10:23:48 -0800 (PST) [thread overview]
Message-ID: <200003081823.KAA26235@google.engr.sgi.com> (raw)
In-Reply-To: <Pine.LNX.3.95.1000308170518.465B-100000@ppp-pat141.tee.gr> from "Stelios Xanthakis" at Mar 08, 2000 05:06:02 PM
>
> The stack space will remain at 400kB even if the rest of the program only
> needs up to 10kB. (I have a patch to view the unused stack through /proc)
Only if you ever touch the stack page, will it be allocated. Else, no
physical page is associated. And if the kernel runs low on memory, it
will reclaim rarely accessed pages.
> I've implemented a patch where the kernel provides the vma->vm_start of
> the stack area through prctl() syscall. Its very simple and adds very
> little to the kernel code.
I believe there is only one foolproof method of determing the stack.
And that is by looking at the user's esp. (Programs probably might
have multiple stack segments, maybe even switch between them by
modifying esp ... in extreme cases. Not sure how pthreads work in
this respect.)
Thus, instead of having the kernel do this, you can do this in
userland by getting /proc/pid/maps, then identifying the vma that
contains the current value of esp. (To get the esp, you can either
write processor specific code, or maybe get the address of a variable
on stack).
Kanoj
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
prev parent reply other threads:[~2000-03-08 18:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-08 15:06 Stelios Xanthakis
2000-03-08 18:23 ` Kanoj Sarcar [this message]
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=200003081823.KAA26235@google.engr.sgi.com \
--to=kanoj@google.engr.sgi.com \
--cc=axanth@tee.gr \
--cc=linux-mm@kvack.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