From: Andrew Morton <akpm@linux-foundation.org>
To: Frank Seidel <fseidel@suse.de>
Cc: linux-kernel@vger.kernel.org, linux-isdn@vger.kernel.org,
fseidel@suse.de, frank@f-seidel.de, jolly@eversberg.eu,
kkeil@suse.de, smurf@smurf.noris.de, andreas@eversberg.eu,
hannes@hanneseder.net
Subject: Re: [PATCH][trivial] mISDN: l1oip - reduce stack memory footprint
Date: Thu, 26 Feb 2009 14:16:32 -0800 [thread overview]
Message-ID: <20090226141632.6e3c041d.akpm@linux-foundation.org> (raw)
In-Reply-To: <49A569D0.2070705@suse.de>
On Wed, 25 Feb 2009 16:54:56 +0100
Frank Seidel <fseidel@suse.de> wrote:
> From: Frank Seidel <frank@f-seidel.de>
>
> Applying kernel janitors todos (reduce stack
> footprint where possible) to l1oip mISDN driver.
> (Before 1656 bytes on i386, now 164)
>
> Signed-off-by: Frank Seidel <frank@f-seidel.de>
> ---
> drivers/isdn/mISDN/l1oip_core.c | 21 +++++++++++++++++----
> 1 file changed, 17 insertions(+), 4 deletions(-)
>
> --- a/drivers/isdn/mISDN/l1oip_core.c
> +++ b/drivers/isdn/mISDN/l1oip_core.c
> @@ -663,18 +663,28 @@ l1oip_socket_thread(void *data)
> struct iovec iov;
> mm_segment_t oldfs;
> struct sockaddr_in sin_rx;
> - unsigned char recvbuf[1500];
> + unsigned char *recvbuf;
> + size_t recvbuf_size = 1500;
> int recvlen;
> struct socket *socket = NULL;
> DECLARE_COMPLETION(wait);
>
> + /* allocate buffer memory */
> + recvbuf = kmalloc(recvbuf_size * sizeof(*recvbuf), GFP_KERNEL);
It's rather pointless to multiply by sizeof(*recvbuf) here
> - iov.iov_len = sizeof(recvbuf);
> + iov.iov_len = recvbuf_size;
> oldfs = get_fs();
> set_fs(KERNEL_DS);
> - recvlen = sock_recvmsg(socket, &msg, sizeof(recvbuf), 0);
> + recvlen = sock_recvmsg(socket, &msg, recvbuf_size, 0);
but not here.
next prev parent reply other threads:[~2009-02-26 22:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-25 15:54 Frank Seidel
2009-02-26 22:16 ` Andrew Morton [this message]
2009-02-25 16:20 Karsten Keil
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=20090226141632.6e3c041d.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andreas@eversberg.eu \
--cc=frank@f-seidel.de \
--cc=fseidel@suse.de \
--cc=hannes@hanneseder.net \
--cc=jolly@eversberg.eu \
--cc=kkeil@suse.de \
--cc=linux-isdn@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=smurf@smurf.noris.de \
/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
Powered by JetHome