From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753331AbcAVLfu (ORCPT ); Fri, 22 Jan 2016 06:35:50 -0500 Received: from mga04.intel.com ([192.55.52.120]:56590 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752730AbcAVLfn (ORCPT ); Fri, 22 Jan 2016 06:35:43 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,330,1449561600"; d="scan'208";a="886911330" From: Alexander Shishkin To: Peter Zijlstra Cc: Ingo Molnar , linux-kernel@vger.kernel.org, vince@deater.net, eranian@google.com, Arnaldo Carvalho de Melo , Jiri Olsa , alexei.starovoitov@gmail.com Subject: Re: [PATCH v2] perf: Synchronously cleanup child events In-Reply-To: <20160119200558.GC6357@twins.programming.kicks-ass.net> References: <20160118144410.GS6357@twins.programming.kicks-ass.net> <1453216354-9282-1-git-send-email-alexander.shishkin@linux.intel.com> <20160119200558.GC6357@twins.programming.kicks-ass.net> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Fri, 22 Jan 2016 13:35:40 +0200 Message-ID: <87lh7hhmnn.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra writes: > So I think there's a number of problems still :-( Also, it does indeed race with __perf_event_exit_task()/sync_child_event(), but that one I'd fix by simply wrapping the sync_child_event()/free_event() in mutex_lock(&parent_event->child_mutex); if (!is_orphan_event(parent_event)) { sync_child_event(child_event); free_event(child_event); } mutex_unlock(&parent_event->child_event); At some later point in time the code there could use a bit of reshuffling, I guess. Regards, -- Alex