All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kirill Korotaev <dev@sw.ru>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@osdl.org>, Dave Hansen <haveblue@us.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sys_getppid oopses on debug kernel (v2)
Date: Wed, 09 Aug 2006 17:02:55 +0400	[thread overview]
Message-ID: <44D9DCFF.2080400@sw.ru> (raw)
In-Reply-To: <20060809165441.GA187@oleg>

>>Your patch doesn't cure the problem.
>>rcu_read_lock just disables preemtion and rcu_dereference
>>introduces memory barrier. _None_ of this _prevents_
>>another CPU from freeing old real_parent in parallel with your dereference.
> 
> 
> How so? Note that release_task() doesn't call put_task_struct(), it does
> call_rcu(&p->rcu, delayed_put_task_struct) instead. When delayed_put_task_struct()
> is called, all CPUs must see the new value of ->real_parent (otherwise
> RCU is just broken). If CPU sees the old value of ->real_parent, rcu_read_lock()
> protects us from delayed_put_task_struct() on another CPU.
> 
> Ok, I think this is the same "classic" pattern as:
> 
> 	old = global_ptr;
> 	global_ptr = new;
> 	call_rcu(..free_old...);
> vs
> 	rcu_read_lock();
> 	use(global_ptr);
> 	rcu_read_unlock();
> 
> Do you agree?
Agree :)
Sorry, I didn't notice that task structs are freed now with RCU :)))
In this case your patch really helps the problem. Care to prepare it?

Thanks,
Kirill

  reply	other threads:[~2006-08-09 13:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-09 14:38 [PATCH] sys_getppid oopses on debug kernel (v2) Oleg Nesterov
2006-08-09 12:08 ` Kirill Korotaev
2006-08-09 16:54   ` Oleg Nesterov
2006-08-09 13:02     ` Kirill Korotaev [this message]
2006-08-09 18:24       ` [PATCH] sys_getppid-oopses-on-debug-kernel-v2-simplify Oleg Nesterov
  -- strict thread matches above, loose matches on Subject: below --
2006-08-08 15:50 [PATCH] sys_getppid oopses on debug kernel (v2) Kirill Korotaev
2006-08-08 16:09 ` Dave Hansen

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=44D9DCFF.2080400@sw.ru \
    --to=dev@sw.ru \
    --cc=akpm@osdl.org \
    --cc=haveblue@us.ibm.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 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.