mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Kyle McMartin <kyle@mcmartin.ca>
Cc: linux kernel <linux-kernel@vger.kernel.org>
Subject: [RFC] is CONFIG_DEBUG_STACK_USAGE supported on STACK_GROWSUP arches ?
Date: Wed, 05 Mar 2008 14:09:04 +0100	[thread overview]
Message-ID: <47CE9B70.6090707@cosmosbay.com> (raw)

Hi Kyle

I was wondering how following code could work on PARISC :

kernel/sched.c

#ifdef CONFIG_DEBUG_STACK_USAGE
        {
                unsigned long *n = end_of_stack(p);
                while (!*n)
                        n++;
                free = (unsigned long)n - (unsigned long)end_of_stack(p);
        }
#endif


I am trying to define a bytes_free_in_stack() function, and was about to 
code something like :

/*
 * Only called in process context
 */
static inline unsigned long bytes_free_in_stack()
{
#ifdef CONFIG_STACK_GROWSUP
   unsigned long free = (unsigned long)end_of_stack(current) - (unsigned 
long)&free;
#else
   unsigned long free = (unsigned long)&free - (unsigned 
long)end_of_stack(current);
#endif
  return free;
}

but I realize it wont work on PARISC (and more generally on 
STACK_GROWSUP arches)

Thank you
Eric




                 reply	other threads:[~2008-03-05 13:55 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=47CE9B70.6090707@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=kyle@mcmartin.ca \
    --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

Powered by JetHome