Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932716AbcLUNTB (ORCPT ); Wed, 21 Dec 2016 08:19:01 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47090 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752116AbcLUNS6 (ORCPT ); Wed, 21 Dec 2016 08:18:58 -0500 Subject: Re: [PATCH v4 2/3] perf tool: add PERF_RECORD_NAMESPACES to include namespaces related info To: Jiri Olsa References: <148182699546.5314.279803283347257825.stgit@hbathini.in.ibm.com> <148182704002.5314.9908823892714757426.stgit@hbathini.in.ibm.com> <20161217174016.GA722@krava> 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 From: Hari Bathini Date: Wed, 21 Dec 2016 18:48:36 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161217174016.GA722@krava> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16122113-0012-0000-0000-000001FA1158 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16122113-0013-0000-0000-000006ADA3B2 Message-Id: <8f9ec1f7-f1d6-2c4c-952f-69a706dce1f6@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-21_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1612210215 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1053 Lines: 39 Hi Jiri, On Saturday 17 December 2016 11:10 PM, Jiri Olsa wrote: > 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? > Adding the new namespaces info to the list while keeping the old ones along with the change timestamp to retain the multiple changes made for the namespaces of each thread. Thanks Hari