Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Sep 2013 09:11:28 -0500
From:      Nathan Whitehorn <nwhitehorn@freebsd.org>
To:        Ryan Stone <rysto32@gmail.com>
Cc:        freebsd-geom@freebsd.org, "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>, Alexander Motin <mav@freebsd.org>, "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>, FreeBSD SCSI <freebsd-scsi@freebsd.org>, =?ISO-8859-1?Q?Olivier_Cochard?= =?ISO-8859-1?Q?-Labb=E9?= <olivier@cochard.me>, Outback Dingo <outbackdingo@gmail.com>
Subject:   Re: [RFC][CFT] GEOM direct dispatch and fine-grained CAM locking
Message-ID:  <52273F90.7020303@freebsd.org>
In-Reply-To: <CAFMmRNzkL%2BuOsC=2Cq_S4Zm5fkmrQRNYcKfijA8yyYcxvLaXPQ@mail.gmail.com>
References:  <520D4ADB.50209@FreeBSD.org> <5224511D.4090503@FreeBSD.org> <20130903134251.GB43281@caravan.chchile.org> <CAKYr3zwjQ9K1c5smZXTESa3T5UnchYaipYQCS2OAJOUFyPBGww@mail.gmail.com> <CA%2Bq%2BTcoeHDbkCOXvBjbbzOKCbb7RLYqG0jn9bHNn_CZgLGarLg@mail.gmail.com> <5226DAB0.1060303@FreeBSD.org> <52272B6F.9060308@freebsd.org> <CAFMmRNzkL%2BuOsC=2Cq_S4Zm5fkmrQRNYcKfijA8yyYcxvLaXPQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 09/04/13 08:20, Ryan Stone wrote:
> On Wed, Sep 4, 2013 at 8:45 AM, Nathan Whitehorn <nwhitehorn@freebsd.org> wrote:
>> Could you describe what this macro is supposed to do so that we can do the
>> porting work?
>> -Nathan
> #define GET_STACK_USAGE(total, used)
>
> GET_STACK_USAGE sets the variable passed in total to the total amount
> of stack space available to the current thread.  used is set to the
> amount of stack space currently used (this does not have to have
> byte-precision).  Netgraph uses this to decide when to stop recursing
> and instead defer to a work queue (to prevent stack overflow).  I
> presume that Alexander is using it in a similar way.  It looks like
> the amd64 version could be ported to other architectures quite easily
> if you were to account for stacks that grow up and stacks that grow
> down:
>
> http://svnweb.freebsd.org/base/head/sys/amd64/include/proc.h?revision=233291&view=markup
>
> /* Get the current kernel thread stack usage. */
> #define GET_STACK_USAGE(total, used) do {                \
>      struct thread    *td = curthread;                \
>      (total) = td->td_kstack_pages * PAGE_SIZE;            \
>      (used) = (char *)td->td_kstack +                \
>          td->td_kstack_pages * PAGE_SIZE -                \
>          (char *)&td;                        \
> } while (0)
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"

I think that should be MI for us anyway. I'm not aware of any 
architectures FreeBSD supports with stacks that grow up. I'll give it a 
test on PPC.
-Nathan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52273F90.7020303>