Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756768AbcLQRkV (ORCPT ); Sat, 17 Dec 2016 12:40:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50700 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751932AbcLQRkU (ORCPT ); Sat, 17 Dec 2016 12:40:20 -0500 Date: Sat, 17 Dec 2016 18:40:16 +0100 From: Jiri Olsa To: Hari Bathini Cc: ast@fb.com, peterz@infradead.org, lkml , acme@kernel.org, alexander.shishkin@linux.intel.com, mingo@redhat.com, daniel@iogearbox.net, rostedt@goodmis.org, Ananth N Mavinakayanahalli , ebiederm@xmission.com, sargun@sargun.me, Aravinda Prasad , brendan.d.gregg@gmail.com Subject: Re: [PATCH v4 2/3] perf tool: add PERF_RECORD_NAMESPACES to include namespaces related info Message-ID: <20161217174016.GA722@krava> References: <148182699546.5314.279803283347257825.stgit@hbathini.in.ibm.com> <148182704002.5314.9908823892714757426.stgit@hbathini.in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <148182704002.5314.9908823892714757426.stgit@hbathini.in.ibm.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 17 Dec 2016 17:40:20 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 781 Lines: 31 On Fri, Dec 16, 2016 at 12:07:20AM +0530, Hari Bathini wrote: SNIP > + > +int thread__set_namespaces(struct thread *thread, u64 timestamp, > + struct namespaces_event *event) > +{ > + struct namespaces *new, *curr = thread__namespaces(thread); > + > + new = namespaces__new(event); > + if (!new) > + return -ENOMEM; > + > + list_add(&new->list, &thread->namespaces_list); > + > + if (timestamp && curr) { > + /* > + * setns syscall must have changed few or all the namespaces > + * of this thread. Update end time for the namespaces > + * previously used. > + */ > + curr = list_next_entry(new, list); > + curr->end_time = timestamp; hi, couldn't you use just the curr you got from thread__namespaces? why to retrieve it again via 'new' pointer? thanks, jirka