mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: ebiederm@xmission.com (Eric W. Biederman)
Cc: oleg@tv-sign.ru, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pidhash: Refactor the pid hash table.
Date: Fri, 10 Mar 2006 15:45:24 -0800	[thread overview]
Message-ID: <20060310154524.3c293b8f.akpm@osdl.org> (raw)
In-Reply-To: <m1irqmi5ma.fsf@ebiederm.dsl.xmission.com>

ebiederm@xmission.com (Eric W. Biederman) wrote:
>
> +fastcall void put_pid(struct pid *pid)
> +{
> +	if (!pid)
> +		return;
> +	if ((atomic_read(&pid->count) == 1) ||
> +	     atomic_dec_and_test(&pid->count))
> +		kmem_cache_free(pid_cachep, pid);
> +}

This looks odd.  It's an RCU callback so it's asynchronous.  It doesn't
take any locks, so if anyone else can have a ref on this thing then the
refcount can change at any time.

And both sides of the || are basically equivalent.  Perhaps you meant &&. 
But I'm more worried by the apparent raciness?

  reply	other threads:[~2006-03-10 23:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-10 17:14 Eric W. Biederman
2006-03-10 23:45 ` Andrew Morton [this message]
2006-03-11  5:39   ` Eric W. Biederman

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=20060310154524.3c293b8f.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    /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

all inboxes | Powered by JetHome®