mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: Russell King <rmk@arm.linux.org.uk>
Cc: kraxel@bytesex.org, linux-kernel@vger.kernel.org
Subject: Re: reducing stack usage in v4l?
Date: Wed, 5 Mar 2003 07:34:37 -0800	[thread overview]
Message-ID: <20030305073437.0673458e.rddunlap@osdl.org> (raw)
In-Reply-To: <20030305093534.A8883@flint.arm.linux.org.uk>

On Wed, 5 Mar 2003 09:35:34 +0000
Russell King <rmk@arm.linux.org.uk> wrote:

| On Wed, Mar 05, 2003 at 10:15:52AM +0100, Gerd Knorr wrote:
| > But when looking at the disasm output it is obvious that it isn't true
| > (at least with gcc 3.2).  On the other hand it is common practice in
| > many drivers, there must be a reason for that, no?  Any chance this
| > used to work with older gcc versions?
| 
| I don't believe so - I seem to remember looking at gcc 2.95 and finding
| the same annoying behaviour.

Yes, that's what I'm seeing with 2.96 as well.

| > Not sure what is the best idea to fix that.  Don't like the kmalloc
| > idea that much.  The individual structs are not huge, the real problem
| > is that many of them are allocated and only few are needed.  Any
| > chance to tell gcc that it should allocate block-local variables at
| > the start block not at the start of the function?
| 
| Not a particularly clean idea, but maybe creating a union of the
| structures and putting that on the stack? (ie, doing what GCC should
| be doing in the first place.)

That's an idea.  Or make separate called functions for each ioctl and declare
the structures inside them?

--
~Randy


Here are some v4l structure sizes from gcc 2.96 on a P4:

sizeof video_audio: 40
sizeof video_buffer: 20
sizeof video_capability: 60
sizeof video_channel: 48
sizeof video_mbuf: 136
sizeof video_mmap: 16
sizeof video_picture: 14
sizeof video_tuner: 52
sizeof video_window: 32
sizeof v4l2_audio: 52
sizeof v4l2_buffer: 68
sizeof v4l2_capability: 104
sizeof v4l2_control: 8
sizeof v4l2_fmtdesc: 64
sizeof v4l2_format: 204
sizeof v4l2_framebuffer: 44
sizeof v4l2_frequency: 44
sizeof v4l2_input: 76
sizeof v4l2_queryctrl: 68
sizeof v4l2_requestbuffers: 20
sizeof v4l2_tuner: 84

  reply	other threads:[~2003-03-05 15:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-05  5:25 Randy.Dunlap
2003-03-05  5:43 ` Andrew Morton
2003-03-05  9:15 ` Gerd Knorr
2003-03-05  9:35   ` Russell King
2003-03-05 15:34     ` Randy.Dunlap [this message]
2003-03-05 21:40       ` Jörn Engel
2003-03-11  4:27       ` Randy.Dunlap
2003-03-11  9:19         ` Gerd Knorr
2003-03-11 16:29           ` Alan Cox
2003-03-11 15:36             ` Daniel Jacobowitz
2003-03-05 11:50   ` mdew
2003-03-05 12:28     ` Gerd Knorr

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=20030305073437.0673458e.rddunlap@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=kraxel@bytesex.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    /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®