[PATCH OLK-6.6] net: dynthread: Reset the napi cpu count on stop and enlarge params
hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/10109 ---------------------------------------- stop_worker() restores the softirq mode and the original IRQ affinity, but leaves dyn_threaded_corenum at the value reached by the load based scaling. clear_corenum_napi() then resets last_threaded_corenum to the default, so a count larger than the default would be applied again on the next start without going through change_dyn_threaded_corenum(), and the stale count also stayed visible to the reader while stopped. Reset dyn_threaded_corenum to dyn_threaded_corenum_default under its lock, like the NO_TASK and NOT_RUNNING paths already do. The ifname module parameter holds up to SCHED_MAX_NETDEV_NUM '#' separated device names of IFNAMSIZ bytes each, which does not fit into the 64 byte buffer. Size ifname, irqname and appname from SCHED_MAX_NETDEV_NUM and IFNAMSIZ, so that the maximum device list is no longer truncated. Fixes: 6d17af1c37ce ("net: dynthread: Monitor the load of the target tasks") Fixes: 4cbecb4ec983 ("net: dynthread: Add dynamic threaded NAPI scheduler framework") Signed-off-by: Cai Xinchen <caixinchen1@huawei.com> --- net/dynthread/net_dynthread.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/net/dynthread/net_dynthread.c b/net/dynthread/net_dynthread.c index c38686b95503..b32c09425fac 100644 --- a/net/dynthread/net_dynthread.c +++ b/net/dynthread/net_dynthread.c @@ -34,15 +34,22 @@ MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Dynamic threaded NAPI scheduler"); -static char ifname[64]; +/* Maximum length of the ifname/irqname/appname module parameters. A + * device name is at most IFNAMSIZ - 1 characters and ifname can hold + * SCHED_MAX_NETDEV_NUM names separated by '#', so a 64 byte buffer is + * too small for the maximum number of devices. + */ +#define DYN_THREAD_PARAM_LEN (SCHED_MAX_NETDEV_NUM * IFNAMSIZ) + +static char ifname[DYN_THREAD_PARAM_LEN]; module_param_string(ifname, ifname, sizeof(ifname), 0444); MODULE_PARM_DESC(ifname, "net device names to monitor, separated by '#'"); -static char irqname[64] = "comp"; +static char irqname[DYN_THREAD_PARAM_LEN] = "comp"; module_param_string(irqname, irqname, sizeof(irqname), 0444); MODULE_PARM_DESC(irqname, "substring of the NIC RX queue IRQ names, default comp"); -static char appname[64] = "mysqld"; +static char appname[DYN_THREAD_PARAM_LEN] = "mysqld"; module_param_string(appname, appname, sizeof(appname), 0644); MODULE_PARM_DESC(appname, "name of the target application threads, default mysqld"); @@ -1395,6 +1402,9 @@ static void stop_worker(void) set_all_napi_threaded(false); recover_irq_affinity(); cpumask_clear(&napi_cpumask); + spin_lock(&dyn_threaded_corenum_lock); + dyn_threaded_corenum = dyn_threaded_corenum_default; + spin_unlock(&dyn_threaded_corenum_lock); clear_corenum_napi(); dyn_threaded_dbg("worker stopped\n"); -- 2.18.0.huawei.25
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://atomgit.com/openeuler/kernel/merge_requests/31010 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/2XW... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://atomgit.com/openeuler/kernel/merge_requests/31010 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/2XW...
participants (2)
-
Cai Xinchen -
patchwork bot