[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20111216.010959.917434953281175910.davem@davemloft.net>
Date: Fri, 16 Dec 2011 01:09:59 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: glommer@...allels.com
Cc: linux-kernel@...r.kernel.org, kamezawa.hiroyu@...fujitsu.com,
netdev@...r.kernel.org, eric.dumazet@...il.com,
cgroups@...r.kernel.org, sfr@...b.auug.org.au
Subject: Re: [PATCH] fix sleeping while atomic problem in sock mem_cgroup.
From: Glauber Costa <glommer@...allels.com>
Date: Fri, 16 Dec 2011 06:37:50 +0400
> Since we can't scan the proto_list to initialize sock cgroups, as it
> holds a rwlock, and we also want to keep the code generic enough to
> avoid calling the initialization functions of protocols directly,
> I propose we keep the interested parties in a separate list. This list
> is protected by a mutex so we can sleep and do the necessary allocations.
>
> Also fixes a reference problem found by Randy Dunlap's randconfig.
>
> Signed-off-by: Glauber Costa <glommer@...allels.com>
Two small changes please:
1) Add an appropriate prefix to your subject line indicating the subsystem
being changed by this patch, "net: fix sleeping ..." would be appropriate
in this case.
2) Put the ifdef'ery into the memcontrol.h header file, rather than sock.c,
f.e. rename register_sock_cgroup to __register_sock_cgroup(), and
unregister_sock_cgroup to __unregister_sock_cgroup. Then create two
helper inlines in memcontrolh:
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
static inline void register_sock_cgroup(struct proto *prot)
{
if (prot->proto_cgroup != NULL)
register_sock_cgroup(prot);
}
static inline void unregister_sock_cgroup(struct proto *prot)
{
if (prot->proto_cgroup != NULL)
unregister_sock_cgroup(prot);
}
#else
static inline void register_sock_cgroup(struct proto *prot)
{
}
static inline void unregister_sock_cgroup(struct proto *prot)
{
}
#endif
Then call these helpers unconditionally in net/core/sock.c
That way you don't need any ifdefs in that file at all.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists