netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Haley <brian.haley@hp.com>
To: "Denis V. Lunev" <den@openvz.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	containers@lists.osdl.org, dlezcano@fr.ibm.com
Subject: Re: [PATCH 1/8 net-2.6.26] [NETNS]: Make netns refconting debug like a socket one.
Date: Tue, 15 Apr 2008 10:55:20 -0400	[thread overview]
Message-ID: <4804C1D8.7000803@hp.com> (raw)
In-Reply-To: <1208263075-28016-1-git-send-email-den@openvz.org>

Denis V. Lunev wrote:
> +#ifdef NETNS_REFCNT_DEBUG
>  static inline struct net *hold_net(struct net *net)
>  {
> +	if (net == NULL)
> +		return NULL;
> +	atomic_inc(&net->use_count);
>  	return net;
>  }

This could be shrunk to:

	if (net)
		atomic_inc(&net->use_count);
	return net;

>  static inline void release_net(struct net *net)
>  {
> +	if (net == NULL)
> +		return;
> +	atomic_dec(&net->use_count);
>  }

This one too:

	if (net)
		atomic_dec(&net->use_count);

-Brian

  reply	other threads:[~2008-04-15 14:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-15 12:35 [PATCH 0/8 net-2.6.26] [NETNS]: namespace refcounting cleanup Denis V. Lunev
2008-04-15 12:37 ` [PATCH 1/8 net-2.6.26] [NETNS]: Make netns refconting debug like a socket one Denis V. Lunev
2008-04-15 14:55   ` Brian Haley [this message]
2008-04-16  8:58     ` David Miller
2008-04-15 12:37 ` [PATCH 2/8 net-2.6.26] [NETNS]: Add netns refcnt debug for kernel sockets Denis V. Lunev
2008-04-15 12:37 ` [PATCH 3/8 net-2.6.26] [NETNS]: Add netns refcnt debug for timewait buckets Denis V. Lunev
2008-04-15 12:37 ` [PATCH 4/8 net-2.6.26] [NETNS]: Add netns refcnt debug into fib_info Denis V. Lunev
2008-04-15 12:37 ` [PATCH 5/8 net-2.6.26] [NETNS]: Add netns refcnt debug for inet bind buckets Denis V. Lunev
2008-04-15 12:37 ` [PATCH 6/8 net-2.6.26] [NETNS]: Add netns refcnt debug for dst ops Denis V. Lunev
2008-04-15 12:37 ` [PATCH 7/8 net-2.6.26] [NETNS]: Add netns refcnt debug to fib rules Denis V. Lunev
2008-04-15 12:37 ` [PATCH 8/8 net-2.6.26] [NETNS]: Add netns refcnt debug for network devices Denis V. Lunev
2008-04-16  9:07 ` [PATCH 0/8 net-2.6.26] [NETNS]: namespace refcounting cleanup David Miller

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=4804C1D8.7000803@hp.com \
    --to=brian.haley@hp.com \
    --cc=containers@lists.osdl.org \
    --cc=davem@davemloft.net \
    --cc=den@openvz.org \
    --cc=dlezcano@fr.ibm.com \
    --cc=netdev@vger.kernel.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).