From: Mark Hemment <markhe@veritas.com>
To: Tigran Aivazian <tigran@veritas.com>
Cc: Matti Aarnio <matti.aarnio@zmailer.org>,
Zeshan Ahmad <zeshan_uet@yahoo.com>,
linux-mm@kvack.org
Subject: Re: stack overflow
Date: Tue, 5 Sep 2000 11:55:32 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.21.0009051147230.15193-200000@alloc> (raw)
In-Reply-To: <Pine.LNX.4.21.0009041219241.1639-100000@saturn.homenet>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1525 bytes --]
Hi,
A quick look indicates what could be the problem.
In my original, the code assumes that all general purpose slabs below
"bufctl_limit" where suitable for bufctl allocation (look at a 2.2.x
version, in kmem_cache_sizes_init() I have a state variable called
"found").
The modified code (by who?), which now uses "offslab_limit", removes
the assumption, which could very well be causing the stack overflow; the
code now breaks the comment "Inc off-slab bufctl limit until the ceiling
is hit" as it has no ceiling.
Bringing back the state variable will close at least one door.
I've attached a completely untested (and uncompiled) patch.
If this doesn't fix it, I'll look deeper.
Mark
On Mon, 4 Sep 2000, Tigran Aivazian wrote:
> On Mon, 4 Sep 2000, Matti Aarnio wrote:
> > > when the function kmem_cache_sizes_init is called in
> > > /init/main.c The exact place where the stack overflow
> > > occurs is in the function kmem_cache_slabmgmt in
> > > /mm/slab.c
> > >
> > > Is there any way to change the stack size in Kernel?
> > > Can the change in stack size simply solve this Kernel
> > > stack overflow problem?
> >
> > That is indicative that somewhere along the path
> > you are: a) recursin
>
> looking at the code, it seems in theory possible to recurse via
> kmem_cache_alloc()->kmem_cache_grow()->kmem_cache_slabmgmt()->kmem_cache_alloc() but
> I thought Mark invented offslab_limit to prevent this.
>
> Maybe decreasing offslab_limit can help? Defer to Mark...
>
> Regards,
> Tigran
>
[-- Attachment #2: slab.patch --]
[-- Type: TEXT/PLAIN, Size: 1152 bytes --]
--- slab.c.00 Tue Sep 5 12:49:16 2000
+++ slab.c Tue Sep 5 12:51:36 2000
@@ -424,14 +424,17 @@
*/
void __init kmem_cache_sizes_init(void)
{
+ unsigned int limit_found;
cache_sizes_t *sizes = cache_sizes;
char name[20];
+
/*
* Fragmentation resistance on low memory - only use bigger
* page orders on machines with more than 32MB of memory.
*/
if (num_physpages > (32 << 20) >> PAGE_SHIFT)
slab_break_gfp_order = BREAK_GFP_ORDER_HI;
+ limit_found = 0;
do {
/* For performance, all the general caches are L1 aligned.
* This should be particularly beneficial on SMP boxes, as it
@@ -446,9 +449,12 @@
}
/* Inc off-slab bufctl limit until the ceiling is hit. */
- if (!(OFF_SLAB(sizes->cs_cachep))) {
- offslab_limit = sizes->cs_size-sizeof(slab_t);
- offslab_limit /= 2;
+ if (limit_found == 0) {
+ if (!(OFF_SLAB(sizes->cs_cachep))) {
+ offslab_limit = sizes->cs_size-sizeof(slab_t);
+ offslab_limit /= 2;
+ } else
+ limit_found = 1;
}
sprintf(name, "size-%Zd(DMA)",sizes->cs_size);
sizes->cs_dmacachep = kmem_cache_create(name, sizes->cs_size, 0,
next prev parent reply other threads:[~2000-09-05 10:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-09-04 10:47 Zeshan Ahmad
2000-09-04 11:03 ` Matti Aarnio
2000-09-04 11:23 ` Tigran Aivazian
2000-09-05 10:55 ` Mark Hemment [this message]
2000-09-05 19:03 Zeshan Ahmad
2000-09-06 8:33 ` Mark Hemment
2000-09-06 13:25 Zeshan Ahmad
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=Pine.LNX.4.21.0009051147230.15193-200000@alloc \
--to=markhe@veritas.com \
--cc=linux-mm@kvack.org \
--cc=matti.aarnio@zmailer.org \
--cc=tigran@veritas.com \
--cc=zeshan_uet@yahoo.com \
/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