lkml.org 
[lkml]   [2019]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] task: Add a count of task rcu users
On 09/04, Frederic Weisbecker wrote:
>
> So what happens if, say:
>
>
> CPU 1 CPU 2
> --------------------------------------------------------------
> rcu_read_lock()
> p = rcu_dereference(rq->task)
> if (refcount_inc_not_zero(p->rcu_users)) {
> .....
> release_task() {
> put_task_struct_rcu_user() {
> call_rcu() {
> queue rcu_head

in this particular case call_rcu() won't be called, so

> }
> }
> }
> put_task_struct_rcu_user(); //here rcu_users has been overwritten

rcu_users won't be overwritten.

But nobody should try to increment ->rcu_users,

rcu_read_lock();
p = rcu_dereference(rq->task);
refcount_inc_not_zero(p->rcu_users);

is already wrong because both release_task/last-schedule can happen in
between, before refcount_inc_not_zero().

Oleg.

\
 
 \ /
  Last update: 2019-09-04 17:34    [W:0.127 / U:0.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site