lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 30 Mar 2015 11:02:39 -0300
From:	Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Jiri Olsa <jolsa@...hat.com>, David Ahern <dsahern@...il.com>,
	Jiri Olsa <jolsa@...nel.org>,
	Stephane Eranian <eranian@...gle.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [BUG] segfault in perf-top -- thread refcnt

Em Mon, Mar 30, 2015 at 10:06:35PM +0900, Namhyung Kim escreveu:
> On Mon, Mar 30, 2015 at 9:56 PM, Jiri Olsa <jolsa@...hat.com> wrote:
> > On Mon, Mar 30, 2015 at 09:48:52PM +0900, Namhyung Kim wrote:
> >> > @@ -380,10 +381,13 @@ static struct thread *__machine__findnew_thread(struct machine *machine,
> >> >     if (!create)
> >> >             return NULL;
> >> >
> >> > -   th = thread__new(pid, tid);
> >> > +   th = thread__new(machine, pid, tid);
> >> >     if (th != NULL) {
> >> > +
> >> > +           pthread_mutex_lock(&machine->threads_lock);
> >> >             rb_link_node(&th->rb_node, parent, p);
> >> >             rb_insert_color(&th->rb_node, &machine->threads);
> >> > +           pthread_mutex_unlock(&machine->threads_lock);
> >>
> >> I think you also need to protect the rb tree traversal above.
> >
> > yep, I already have another version.. but it blows on another place ;-)
> >
> >>
> >> But this makes every sample processing grabs and releases the lock so
> >> might cause high overhead.  It can be a problem if such processing is
> >> done parallelly like my multi-thread work. :-/
> >
> > yep.. perhaps instead of more locking we need to find a way where
> > only single thread do the update on hists/threads
> 
> Agreed.
> 
> AFAIK the reason we do ref-counting is to cleanup dead/exited thread
> for live session like perf top.  In that case we can somehow mark
> to-be-deleted thread and kill it in a safe time/place..

Humm, you mean have another list node in struct threads and add threads
to another dead_threads like list, i.e. one that is _really_ dead as no
more refcounts point to it, and then amortize the costs of removing it
from the rb_tree by removing multiple threads instead of just one?

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ