]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drivers/base/node.c: fix compaction sysfs file leak
authorMiaohe Lin <linmiaohe@huawei.com>
Fri, 29 Apr 2022 06:16:06 +0000 (23:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:21:16 +0000 (10:21 +0200)
[ Upstream commit da63dc84befaa9e6079a0bc363ff0eaa975f9073 ]

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: ed4a6d7f0676 ("mm: compaction: add /sys trigger for per-node memory compaction")
Signed-off-by: Miaohe 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/base/node.c

index 21965de8538bea60ba1a32818647f9d4b516c804..5f745c906c3307012049510b17c266e4de071d32 100644 (file)
@@ -655,6 +655,7 @@ static int register_node(struct node *node, int num)
  */
 void unregister_node(struct node *node)
 {
+       compaction_unregister_node(node);
        hugetlb_unregister_node(node);          /* no-op, if memoryless node */
        node_remove_accesses(node);
        node_remove_caches(node);