netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
To: glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org
Subject: Re: [PATCH] fix sleeping while atomic problem in sock mem_cgroup.
Date: Fri, 16 Dec 2011 01:09:59 -0500 (EST)	[thread overview]
Message-ID: <20111216.010959.917434953281175910.davem@davemloft.net> (raw)
In-Reply-To: <1324003070-6573-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>

From: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
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-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>

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 cgroups" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2011-12-16  6:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-16  2:37 [PATCH] fix sleeping while atomic problem in sock mem_cgroup Glauber Costa
     [not found] ` <1324003070-6573-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-12-16  6:09   ` David Miller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111216.010959.917434953281175910.davem@davemloft.net \
    --to=davem-ft/pcqaiutieiz0/mpfg9q@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
    --cc=kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).