All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Matt Fleming <matt@console-pimps.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: __lock_task_sighand() and RCU
Date: Mon, 28 Mar 2011 15:36:02 +0200	[thread overview]
Message-ID: <20110328133602.GA8612@redhat.com> (raw)
In-Reply-To: <20110328085654.26a75db6@mfleming-mobl1.ger.corp.intel.com>

Hi Matt,

On 03/28, Matt Fleming wrote:
>
> I've been reading __lock_task_sighand() and I can't quite wrap my head
> around what the rcu_read_lock()/rcu_read_unlock() is protecting in
> there.

It protects ->sighand.

> Initially I assumed that it was protecting the 'tsk' argument,

No. the caller must have a reference.

> Then I wondered if it was protecting the sighand from being freed from
> under us while we're trying to lock it.

Yes,

> But sighands aren't freed via
> rcu,

it is ;)

> it's just a simple refcnt and kmem_cache_free()

Yes, but please note that sighand_cachep was created with
SLAB_DESTROY_BY_RCU.

Oleg.


  reply	other threads:[~2011-03-28 14:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28  7:56 __lock_task_sighand() and RCU Matt Fleming
2011-03-28 13:36 ` Oleg Nesterov [this message]
2011-03-28 15:04   ` Matt Fleming

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=20110328133602.GA8612@redhat.com \
    --to=oleg@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@console-pimps.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.