【标题描述】能够简要描述问题:说明什么场景下,做了什么操作,出现什么问题(尽量使用正向表达方式)
创建workqueue工作队列,在工作队列仍在工作状态下,发起销毁工作队列,有概率发生warning
【环境信息】
硬件信息:
1) 裸机场景提供出问题的硬件信息;
2) 虚机场景提供虚机XML文件或者配置信息
软件信息:
1) OS版本及分支
2) 内核信息
3) 发现问题的组件版本信息
如果有特殊组网,请提供网络拓扑图
【问题复现步骤】
具体操作步骤
出现概率(是否必现,概率性错误)
概率性错误
【预期结果】
描述预期结果,可以通过对比新老版本获取
消除 warning
【实际结果】
描述出问题的结果
该问题会导致 struct pool_workqueue 内存泄漏
【附件信息】
比如系统message日志/组件日志、dump信息、图片等
[ 115.195073] 99 done
[ 115.317571] ------------[ cut here ]------------
[ 115.327449] WARNING: CPU: 3 PID: 130 at kernel/workqueue.c:4453 destroy_workqueue+0xf8/0x2d0
[ 115.328262] Modules linked in: wq_issue(O-)
[ 115.330528] CPU: 3 PID: 130 Comm: rmmod Tainted: G O 5.10.0-03441-g527301dba422-dirty #131
[ 115.331028] Hardware name: linux,dummy-virt (DT)
[ 115.331875] pstate: 20000085 (nzCv daIf -PAN -UAO -TCO BTYPE=--)
[ 115.332274] pc : destroy_workqueue+0xf8/0x2d0
[ 115.332507] lr : destroy_workqueue+0xac/0x2d0
[ 115.332735] sp : ffff8000135dbda0
[ 115.332963] x29: ffff8000135dbda0 x28: ffff0000c085eac0
[ 115.333348] x27: 0000000000000000 x26: 0000000000000000
[ 115.333627] x25: 0000000000000000 x24: 0000000000000000
[ 115.333903] x23: ffff0000c0027620 x22: ffff800011b81068
[ 115.334180] x21: ffff0000c0027600 x20: ffff00027ebdd900
[ 115.334459] x19: ffff00027ebdd924 x18: 0000000000000000
[ 115.334777] x17: 0000000000000000 x16: 0000000000000000
[ 115.335195] x15: 0000000000000173 x14: 0000000000000251
[ 115.335638] x13: 0000000000000001 x12: 0000000000000000
[ 115.335912] x11: 0000000000000001 x10: 000000000000033e
[ 115.336208] x9 : 00000000000f1000 x8 : 0000000000000003
[ 115.336483] x7 : 00000000ffffffff x6 : ffff00027ebd9118
[ 115.336858] x5 : 0000000000000003 x4 : 0000000000000000
[ 115.337361] x3 : ffff00027ebd8000 x2 : ffff00027ebdd958
[ 115.337649] x1 : 0000000000000001 x0 : 0000000000000000
[ 115.338143] Call trace:
[ 115.338498] destroy_workqueue+0xf8/0x2d0
[ 115.339541] wq_test_exit+0x10/0x24 [wq_issue]
[ 115.339779] __arm64_sys_delete_module+0x184/0x250
[ 115.340020] do_el0_svc+0x84/0x1d0
[ 115.340201] el0_svc+0x10/0x1c
[ 115.340356] el0_sync_handler+0xa8/0xf0
[ 115.340549] el0_sync+0x158/0x180
[ 115.340870] ---[ end trace ad43b955b80573a2 ]---
[ 115.341484] destroy_workqueue: my_workqueue has the following busy pwq
[ 115.341840] pwq 6: cpus=3 node=0 flags=0x0 nice=0 active=1/1 refcnt=2
[ 115.342862] pending: my_work_function
[ 115.346575] Sanity checks
[ 115.348693] Showing busy workqueues and worker pools:
[ 115.349232] workqueue events_power_efficient: flags=0x82
[ 115.350752] pwq 8: cpus=0-3 flags=0x4 nice=0 active=1/256 refcnt=3
[ 115.351409] pending: neigh_periodic_work
[ 115.352947] wq_test_exit
复现测试用例:
+#include <linux/module.h>
+#include <linux/delay.h>
+
+#define NR_WORK 100
+
+struct workqueue_struct *my_workqueue;
+
+struct my_work_struct {
+ struct work_struct work;
+ int index;
+};
+struct my_work_struct my_work[NR_WORK];
+
+void my_work_function(struct work_struct *work)
+{
+ msleep(100);
+}
+
+static int wq_test_init(void)
+{
+ int i;
+
+ pr_info("wq_test_init\n");
+
+ my_workqueue = create_workqueue("my_workqueue");
+
+ for (i = 0; i < NR_WORK; i++) {
+ INIT_WORK((struct work_struct *)(my_work + i), my_work_function);
+ my_work[i].index = i;
+ // queue_work(ret_my_workqueue(), (struct work_struct *)(my_work + i));
+ queue_work(my_workqueue, (struct work_struct *)(my_work + i));
+ }
+
+ pr_info("wq_test_init done\n");
+ return 0;
+}
+
+static void wq_test_exit(void)
+{
+ flush_work((struct work_struct *)(my_work + (NR_WORK - 1)));
+ destroy_workqueue(my_workqueue);
+
+ pr_info("wq_test_exit done\n");
+ return;
+}
+
+module_init(wq_test_init);
+module_exit(wq_test_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("workqueue issue");
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论