linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <lk@tantalophile.demon.co.uk>
To: James Antill <james@and.org>
Cc: axanth@tee.gr, linux-mm@kvack.org
Subject: Re: Stack & policy
Date: Thu, 13 Apr 2000 02:35:28 +0200	[thread overview]
Message-ID: <20000413023528.D27244@pcep-jamie.cern.ch> (raw)
In-Reply-To: <nnaeizpdfu.fsf@code.and.org>; from James Antill on Wed, Apr 12, 2000 at 11:05:25AM -0400

James Antill wrote:
> > Some time ago I posted a message about a kernel feature where the
> > application can request the vma->vm_start of its stack virtual memory area
> > in order to unmap part of the unused stack (esp - vma->vm_start).
> > 
> > Such a feature is very useful for an alternative programming technique.
> 
>  Have you seen jamie and chuck talking about madvise() flags ?
>  Just doing madvise(cur_stack, MADV_DONTNEED, cur_stack - end_stack)[1]
> after a function that uses alloca() or has a large auto should be
> a pretty simple addition to gcc (although you might not want to put it
> there).
> 
>  Those seem like a much better idea to me, as they can also be used in
> pthreads (much as I hate pthreads) and other bits of memory that has
> similar usage patterns.
>  This would also be much more likely to work on other OSes.

You'd use MADV_FREE, as it allows the app to reuse stack pages
immediately without the overhead of them being unmapped, remapped and
rezeroed -- if it reuses them before the kernel finds another use for
them.  The most efficiently place to put this call is probably in a
timer signal handler.

You still need to get the base of the mapped region though.  You can
parse /proc/self/maps for this :-)

-- Jamie
--
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/

  reply	other threads:[~2000-04-13  0:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-12 14:45 Stelios Xanthakis
2000-04-12 15:05 ` James Antill
2000-04-13  0:35   ` Jamie Lokier [this message]
2000-04-14 13:10     ` Stelios Xanthakis

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=20000413023528.D27244@pcep-jamie.cern.ch \
    --to=lk@tantalophile.demon.co.uk \
    --cc=axanth@tee.gr \
    --cc=james@and.org \
    --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