提交 c3dc7b42 编写于 作者: M Miaohe Lin 提交者: Laibin Qiu

drivers/base/node.c: fix compaction sysfs file leak

stable inclusion
from stable-4.19.247
commit f76ddc8fcf6d81fe89bfa4d3efcbc4fe69a91d48
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5FNPY
CVE: NA

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

[ Upstream commit da63dc84 ]

Compaction sysfs file is created via compaction_register_node in
register_node.  But we forgot to remove it in unregister_node.  Thus
compaction sysfs file is leaked.  Using compaction_unregister_node to fix
this issue.

Link: https://lkml.kernel.org/r/20220401070905.43679-1-linmiaohe@huawei.com
Fixes: ed4a6d7f ("mm: compaction: add /sys trigger for per-node memory compaction")
Signed-off-by: NMiaohe Lin <linmiaohe@huawei.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
Signed-off-by: NLaibin Qiu <qiulaibin@huawei.com>
上级 7df02fb0
...@@ -643,6 +643,7 @@ static int register_node(struct node *node, int num) ...@@ -643,6 +643,7 @@ static int register_node(struct node *node, int num)
*/ */
void unregister_node(struct node *node) void unregister_node(struct node *node)
{ {
compaction_unregister_node(node);
hugetlb_unregister_node(node); /* no-op, if memoryless node */ hugetlb_unregister_node(node); /* no-op, if memoryless node */
node_remove_accesses(node); node_remove_accesses(node);
node_remove_caches(node); node_remove_caches(node);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册