[Devel] [PATCH rh7 3/3] net/packet: use try_get_mem_cgroup_from_mm
Vladimir Davydov
vdavydov at parallels.com
Mon Jun 15 09:33:39 PDT 2015
... instead of home home bred try_get_mem_cgroup_from_current, and zap
the latter.
Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
include/linux/memcontrol.h | 1 -
mm/memcontrol.c | 14 --------------
net/packet/af_packet.c | 4 ++--
3 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 5e0e7c15f81a..e09ec923a5d1 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -82,7 +82,6 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg)
extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm);
-extern struct mem_cgroup *try_get_mem_cgroup_from_current(void);
extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b883404f3c28..08bc82eb86e7 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -554,20 +554,6 @@ void sock_update_memcg(struct sock *sk)
}
EXPORT_SYMBOL(sock_update_memcg);
-struct mem_cgroup *try_get_mem_cgroup_from_current(void)
-{
- struct mem_cgroup *cg;
-
- rcu_read_lock();
- cg = mem_cgroup_from_task(current);
- if (mem_cgroup_is_root(cg) || !css_tryget(&cg->css))
- cg = NULL;
- rcu_read_unlock();
-
- return cg;
-}
-EXPORT_SYMBOL(try_get_mem_cgroup_from_current);
-
void sock_release_memcg(struct sock *sk)
{
if (mem_cgroup_sockets_enabled && sk->sk_cgrp) {
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 7cd659a947cb..46d80c2449d5 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2437,8 +2437,8 @@ static struct cg_proto *packet_sk_charge(void)
if (!psc)
return ERR_PTR(-ENOMEM);
- psc->memcg = try_get_mem_cgroup_from_current();
- if (psc->memcg && memcg_kmem_is_active(psc->memcg)) {
+ psc->memcg = try_get_mem_cgroup_from_mm(current->mm);
+ if (memcg_kmem_is_active(psc->memcg)) {
/*
* Forcedly charge the maximum amount of data this socket
* may have. It's typically not huge and packet sockets are
--
2.1.4
More information about the Devel
mailing list