Unverified Commit 9f077cd1 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files
parents 26bfb7d9 110e3f25
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3360,6 +3360,7 @@ void dhugetlb_pool_put(struct dhugetlb_pool *hpool)

	if (atomic_dec_and_test(&hpool->refcnt)) {
		css_put(&hpool->attach_memcg->css);
		synchronize_rcu();
		kfree(hpool);
	}
}
@@ -3500,9 +3501,14 @@ struct dhugetlb_pool *get_dhugetlb_pool_from_task(struct task_struct *tsk)

	rcu_read_lock();
	memcg = mem_cgroup_from_task(tsk);
	if (!memcg || !css_tryget(&memcg->css)) {
		rcu_read_unlock();
		return NULL;
	}
	rcu_read_unlock();

	hpool = get_dhugetlb_pool_from_memcg(memcg);
	css_put(&memcg->css);

	return hpool;
}
+8 −3
Original line number Diff line number Diff line
@@ -4701,14 +4701,19 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
struct dhugetlb_pool *get_dhugetlb_pool_from_memcg(struct mem_cgroup *memcg)
{
	struct mem_cgroup_extension *memcg_ext;
	struct dhugetlb_pool *hpool;

	if (!memcg)
		return NULL;

	rcu_read_lock();
	memcg_ext = container_of(memcg, struct mem_cgroup_extension, memcg);
	if (dhugetlb_pool_get(memcg_ext->hpool))
		return memcg_ext->hpool;
	return NULL;
	hpool = memcg_ext->hpool;
	if (!dhugetlb_pool_get(hpool))
		hpool = NULL;
	rcu_read_unlock();

	return hpool;
}

static void set_dhugetlb_pool_to_memcg(struct mem_cgroup *memcg,