From: Richard Gooch <rgooch@ras.ucalgary.ca>
To: "Akash Jain" <aki.jain@stanford.edu>
Cc: <torvalds@transmeta.com>, <alan@lxorguk.ukuu.org.uk>,
<linux-kernel@vger.kernel.org>,
<su.class.cs99q@nntp.stanford.edu>
Subject: Re: [PATCH] fs/devfs/base.c
Date: Sun, 27 May 2001 09:21:50 -0400 [thread overview]
Message-ID: <200105271321.f4RDLoM00342@mobilix.ras.ucalgary.ca> (raw)
In-Reply-To: <GLEPIDKFGKPCBDLKDHEAAELGDDAA.aki.jain@stanford.edu>
In-Reply-To: <GLEPIDKFGKPCBDLKDHEAAELGDDAA.aki.jain@stanford.edu>
Akash Jain writes:
> hello,
>
> in fs/devfs/base.c,
> the struct devfsd_notify_struct is approx 1056 bytes, allocating it
> on a stack of 8k seems unreasonable. here we simply move it to the
> heap, i don't think it is a _must_ be on stack type thing
I absolutely don't want this patch applied. It's bogus. It is entirely
safe to alloc 1 kB on the stack in this code, since it has a short and
well-controlled code path from syscall entry to the function. This is
not some function that can be called from some random place in the
kernel and thus has a random call path.
Using the stack is much faster than calling kmalloc() and it also
doesn't add to system memory pressure. That's why I did it this way in
the first place. Further, it's much safer to use the stack, since the
memory is freed automatically. Thus, there's less scope for
introducing errors.
Please fix your checker to deal with this class of functions which
have a well-defined call path. I'd suggest looking at the total stack
allocations from syscall entry point all the way to the end function.
Ideally, you'd trace the call path to every function, but of course
that may be computationally infeasible. Hopefully it's feasible to do
this for any function which has a stack allocation which exceeds some
threshold.
Regards,
Richard....
Permanent: rgooch@atnf.csiro.au
Current: rgooch@ras.ucalgary.ca
next prev parent reply other threads:[~2001-05-28 2:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-27 10:12 Akash Jain
2001-05-27 13:21 ` Richard Gooch [this message]
2001-05-28 14:43 ` Maximum size of automatic allocation? (was: [PATCH] fs/devfs/base.c) Daniel Phillips
2001-06-03 23:55 ` [PATCH] fs/devfs/base.c Linus Torvalds
2001-06-04 6:44 ` Alan Cox
2001-06-04 10:09 ` Linus Torvalds
2001-06-05 1:41 ` Dawson R Engler
2001-06-05 8:49 ` Ingo Molnar
2001-06-04 7:07 ` Richard Gooch
2001-06-04 19:26 ` Bill Pringlemeir
2001-06-04 19:39 ` Kernel Stack usage [was: [PATCH] fs/devfs/base.c] Bill Pringlemeir
2001-06-05 6:10 ` [PATCH] fs/devfs/base.c H. Peter Anvin
2001-06-05 6:56 ` Alan Cox
2001-06-05 11:37 ` Andrew Morton
2001-06-05 21:38 ` Pavel Machek
2001-06-04 20:15 ` Daniel Phillips
2001-06-05 4:24 ` Paul Mackerras
2001-06-04 0:03 ` Richard Gooch
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=200105271321.f4RDLoM00342@mobilix.ras.ucalgary.ca \
--to=rgooch@ras.ucalgary.ca \
--cc=aki.jain@stanford.edu \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=su.class.cs99q@nntp.stanford.edu \
--cc=torvalds@transmeta.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
all inboxes | Powered by JetHome®