提交 50a75ac6 编写于 作者: A Arnd Bergmann 提交者: Yang Yingliang

ethtool: reduce stack usage with clang

stable inclusion
from linux-4.19.97
commit 81f7503fb41bf734bfc7ce2d38bb537d3c15214b

--------------------------------

commit 3499e87e upstream.

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: NArnd Bergmann <arnd@arndb.de>
Reviewed-by: NMichal Kubecek <mkubecek@suse.cz>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NMiles Chen <miles.chen@mediatek.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NLi Aichun <liaichun@huawei.com>
Reviewed-by: Nguodeqing <geffrey.guo@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 be983eed
...@@ -2413,9 +2413,10 @@ static int ethtool_set_tunable(struct net_device *dev, void __user *useraddr) ...@@ -2413,9 +2413,10 @@ static int ethtool_set_tunable(struct net_device *dev, void __user *useraddr)
return ret; return ret;
} }
static int ethtool_get_per_queue_coalesce(struct net_device *dev, static noinline_for_stack int
void __user *useraddr, ethtool_get_per_queue_coalesce(struct net_device *dev,
struct ethtool_per_queue_op *per_queue_opt) void __user *useraddr,
struct ethtool_per_queue_op *per_queue_opt)
{ {
u32 bit; u32 bit;
int ret; int ret;
...@@ -2443,9 +2444,10 @@ static int ethtool_get_per_queue_coalesce(struct net_device *dev, ...@@ -2443,9 +2444,10 @@ static int ethtool_get_per_queue_coalesce(struct net_device *dev,
return 0; return 0;
} }
static int ethtool_set_per_queue_coalesce(struct net_device *dev, static noinline_for_stack int
void __user *useraddr, ethtool_set_per_queue_coalesce(struct net_device *dev,
struct ethtool_per_queue_op *per_queue_opt) void __user *useraddr,
struct ethtool_per_queue_op *per_queue_opt)
{ {
u32 bit; u32 bit;
int i, ret = 0; int i, ret = 0;
...@@ -2499,7 +2501,7 @@ static int ethtool_set_per_queue_coalesce(struct net_device *dev, ...@@ -2499,7 +2501,7 @@ static int ethtool_set_per_queue_coalesce(struct net_device *dev,
return ret; return ret;
} }
static int ethtool_set_per_queue(struct net_device *dev, static int noinline_for_stack ethtool_set_per_queue(struct net_device *dev,
void __user *useraddr, u32 sub_cmd) void __user *useraddr, u32 sub_cmd)
{ {
struct ethtool_per_queue_op per_queue_opt; struct ethtool_per_queue_op per_queue_opt;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册