From: Kefeng Wang wangkefeng.wang@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I9CHG1 CVE: NA
--------------------------------
Since the struct shrinker was not introduced in OLK6.6, the vmalloc lock contention series of patches conflict. Fix this problem by introducing a struct shrinker.
Signed-off-by: Kefeng Wang wangkefeng.wang@huawei.com Signed-off-by: ZhangPeng zhangpeng362@huawei.com --- mm/vmalloc.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index ce8e920a6400..c90d9309f80c 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -5254,9 +5254,13 @@ vmap_node_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) return SHRINK_STOP; }
+static struct shrinker vmap_node_shrinker = { + .count_objects = vmap_node_shrink_count, + .scan_objects = vmap_node_shrink_scan, +}; + void __init vmalloc_init(void) { - struct shrinker *vmap_node_shrinker; struct vmap_area *va; struct vmap_node *vn; struct vm_struct *tmp; @@ -5305,13 +5309,6 @@ void __init vmalloc_init(void) vmap_init_free_space(); vmap_initialized = true;
- vmap_node_shrinker = shrinker_alloc(0, "vmap-node"); - if (!vmap_node_shrinker) { + if (register_shrinker(&vmap_node_shrinker, "vmap-node")) pr_err("Failed to allocate vmap-node shrinker!\n"); - return; - } - - vmap_node_shrinker->count_objects = vmap_node_shrink_count; - vmap_node_shrinker->scan_objects = vmap_node_shrink_scan; - shrinker_register(vmap_node_shrinker); }