From: Denis Vlasenko <vda@ilport.com.ua>
To: Jeff Garzik <jgarzik@pobox.com>, Yum Rayan <yum.rayan@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Reduce stack usage in time.c
Date: Thu, 31 Mar 2005 12:26:58 +0300 [thread overview]
Message-ID: <200503311226.58037.vda@ilport.com.ua> (raw)
In-Reply-To: <424BB443.1070508@pobox.com>
On Thursday 31 March 2005 11:26, Jeff Garzik wrote:
> Yum Rayan wrote:
> > Attempt to reduce stack usage in time.c (linux-2.6.12-rc1-mm3). Stack
> > usage was noted using checkstack.pl. Specifically:
> >
> > Before patch
> > ------------
> > sys_adjtimex - 128
> >
> > After patch
> > -----------
> > sys_adjtimex - none (register usage only)
> >
> > Signed-off-by: Yum Rayan <yum.rayan@gmail.com>
> >
> > --- a/kernel/time.c 2005-03-25 22:11:06.000000000 -0800
> > +++ b/kernel/time.c 2005-03-30 16:59:51.000000000 -0800
> > @@ -413,17 +413,27 @@
> >
> > asmlinkage long sys_adjtimex(struct timex __user *txc_p)
> > {
> > - struct timex txc; /* Local copy of parameter */
> > - int ret;
> > + struct timex *txc; /* Local copy of parameter */
> > + int retval;
> > +
> > + txc = kmalloc(sizeof(struct timex), GFP_KERNEL);
> > + if (!txc)
> > + return -ENOMEM;
> >
> > /* Copy the user data space into the kernel copy
> > * structure. But bear in mind that the structures
> > * may change
> > */
> > - if(copy_from_user(&txc, txc_p, sizeof(struct timex)))
> > - return -EFAULT;
> > - ret = do_adjtimex(&txc);
> > - return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : ret;
> > + if(copy_from_user(txc, txc_p, sizeof(struct timex))) {
> > + retval = -EFAULT;
> > + goto free_txc;
> > + }
> > + retval = do_adjtimex(txc);
> > + if (copy_to_user(txc_p, txc, sizeof(struct timex)))
> > + retval = -EFAULT;
> > +free_txc:
Is this a syscall?
Is it ever called from some deeply nested kernel function?
--
vda
next prev parent reply other threads:[~2005-03-31 9:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-31 7:46 [PATCH] Reduce stack usage in time.c Yum Rayan
2005-03-31 8:26 ` Jeff Garzik
2005-03-31 9:26 ` Denis Vlasenko [this message]
2005-03-31 13:00 ` Jörn Engel
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=200503311226.58037.vda@ilport.com.ua \
--to=vda@ilport.com.ua \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yum.rayan@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.