mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ronald S. Bultje" <rbultje@ronald.bitfreak.net>
To: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org, mjpeg-developer@lists.sf.net,
	"Randy.Dunlap" <rddunlap@osdl.org>
Subject: [PATCH 3/3] 2.6.10 zr36067 driver - reduce stack size usage
Date: Wed, 29 Dec 2004 23:49:16 +0100	[thread overview]
Message-ID: <1104360446.25472.87.camel@tux.lan> (raw)

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

Hi Andrew/Linus,

>From original message (by Randy Dunlap):

"Reduce local variable (large struct) stack usage in zoran_do_ioctl()
from 1028 bytes to 324 bytes (on x86-32) by declaring & using only 1
"struct zoran_jpg_settings" instead of 5 instances of it. Reduced from 5
* 180 bytes to 1 * 180 bytes, plus other locals in each case."

Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
Signed-off-by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>

Regards,

Ronald
-- 
Ronald S. Bultje <rbultje@ronald.bitfreak.net>

[-- Attachment #2: zoran-stacksize.diff --]
[-- Type: text/x-patch, Size: 1846 bytes --]

Index: linux-2.6.10/drivers/media/video/zoran_driver.c
===================================================================
--- linux-2.6.10.orig/drivers/media/video/zoran_driver.c	2004-12-29 21:56:27.714436423 +0100
+++ linux-2.6.10/drivers/media/video/zoran_driver.c	2004-12-29 21:57:20.784771392 +0100
@@ -2014,6 +2014,8 @@
 {
 	struct zoran_fh *fh = file->private_data;
 	struct zoran *zr = fh->zr;
+	/* CAREFUL: used in multiple places here */
+	struct zoran_jpg_settings settings;
 
 	/* we might have older buffers lying around... We don't want
 	 * to wait, but we do want to try cleaning them up ASAP. So
@@ -2462,7 +2464,6 @@
 	case BUZIOC_S_PARAMS:
 	{
 		struct zoran_params *bparams = arg;
-		struct zoran_jpg_settings settings;
 		int res = 0;
 
 		dprintk(3, KERN_DEBUG "%s: BUZIOC_S_PARAMS\n", ZR_DEVNAME(zr));
@@ -2919,8 +2920,6 @@
 			}
 
 			if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) {
-				struct zoran_jpg_settings settings;
-
 				down(&zr->resource_lock);
 
 				settings = fh->jpg_settings;
@@ -3983,7 +3982,8 @@
 	{
 		struct v4l2_crop *crop = arg;
 		int res = 0;
-		struct zoran_jpg_settings settings = fh->jpg_settings;
+
+		settings = fh->jpg_settings;
 
 		dprintk(3,
 			KERN_ERR
@@ -4065,9 +4065,10 @@
 	case VIDIOC_S_JPEGCOMP:
 	{
 		struct v4l2_jpegcompression *params = arg;
-		struct zoran_jpg_settings settings = fh->jpg_settings;
 		int res = 0;
 
+		settings = fh->jpg_settings;
+
 		dprintk(3,
 			KERN_DEBUG
 			"%s: VIDIOC_S_JPEGCOMP - quality=%d, APPN=%d, APP_len=%d, COM_len=%d\n",
@@ -4151,8 +4152,7 @@
 			down(&zr->resource_lock);
 
 			if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) {
-				struct zoran_jpg_settings settings =
-				    fh->jpg_settings;
+				settings = fh->jpg_settings;
 
 				/* we actually need to set 'real' parameters now */
 				if ((fmt->fmt.pix.height * 2) >

                 reply	other threads:[~2004-12-29 22:52 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=1104360446.25472.87.camel@tux.lan \
    --to=rbultje@ronald.bitfreak.net \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjpeg-developer@lists.sf.net \
    --cc=rddunlap@osdl.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®