From: Michal Kubecek <mkubecek@suse.cz>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
Jakub Kicinski <jakub.kicinski@netronome.com>,
Jiri Pirko <jiri@mellanox.com>,
Nick Desaulniers <ndesaulniers@google.com>,
Kees Cook <keescook@chromium.org>, Wenwen Wang <wang6495@umn.edu>,
Ilya Lesokhin <ilyal@mellanox.com>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Edward Cree <ecree@solarflare.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ethtool: reduce stack usage with clang
Date: Thu, 7 Mar 2019 11:06:05 +0100 [thread overview]
Message-ID: <20190307100605.GA20309@unicorn.suse.cz> (raw)
In-Reply-To: <20190307093408.3425010-1-arnd@arndb.de>
On Thu, Mar 07, 2019 at 10:33:35AM +0100, Arnd Bergmann wrote:
> clang inlines the dev_ethtool() more aggressively than gcc does, leading
> to a larger amount of used stack space:
>
> net/core/ethtool.c:2536:24: error: stack frame size of 1216 bytes in function 'dev_ethtool' [-Werror,-Wframe-larger-than=]
>
> Marking the sub-functions that require the most stack space as
> noinline_for_stack gives us reasonable behavior on all compilers.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> net/core/ethtool.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index d4918ffddda8..fcbed78172a0 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
...
> @@ -2533,7 +2535,7 @@ static int ethtool_set_fecparam(struct net_device *dev, void __user *useraddr)
>
> /* The main entry point in this file. Called from net/core/dev_ioctl.c */
>
> -int dev_ethtool(struct net *net, struct ifreq *ifr)
> +int noinline_for_stack dev_ethtool(struct net *net, struct ifreq *ifr)
> {
> struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name);
> void __user *useraddr = ifr->ifr_data;
Is this part really needed? AFAICS dev_ethtool() is only called from
dev_ioctl() which is in a different compilation unit so that
dev_ethtool() won't be inlined anyway.
Michal Kubecek
next prev parent reply other threads:[~2019-03-07 10:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-07 9:33 [PATCH] ethtool: reduce stack usage with clang Arnd Bergmann
2019-03-07 10:06 ` Michal Kubecek [this message]
2019-03-07 15:59 ` Arnd Bergmann
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=20190307100605.GA20309@unicorn.suse.cz \
--to=mkubecek@suse.cz \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=ecree@solarflare.com \
--cc=f.fainelli@gmail.com \
--cc=ilyal@mellanox.com \
--cc=jakub.kicinski@netronome.com \
--cc=jiri@mellanox.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=wang6495@umn.edu \
/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;
as well as URLs for NNTP newsgroup(s).