From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f199.google.com (mail-qk0-f199.google.com [209.85.220.199]) by kanga.kvack.org (Postfix) with ESMTP id 848B16B0007 for ; Tue, 10 Apr 2018 04:19:30 -0400 (EDT) Received: by mail-qk0-f199.google.com with SMTP id o63so7853710qki.12 for ; Tue, 10 Apr 2018 01:19:30 -0700 (PDT) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id y18si2813709qta.268.2018.04.10.01.19.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 01:19:29 -0700 (PDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3A8Iqhc114269 for ; Tue, 10 Apr 2018 04:19:28 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h8rqf2m17-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 10 Apr 2018 04:19:28 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Apr 2018 09:19:25 +0100 From: Ravi Bangoria Subject: Re: [PATCH v2 7/9] trace_uprobe/sdt: Fix multiple update of same reference counter References: <20180404083110.18647-1-ravi.bangoria@linux.vnet.ibm.com> <20180404083110.18647-8-ravi.bangoria@linux.vnet.ibm.com> <20180409132928.GA25722@redhat.com> Date: Tue, 10 Apr 2018 13:49:12 +0530 MIME-Version: 1.0 In-Reply-To: <20180409132928.GA25722@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Message-Id: <84c1e60f-8aad-a0ce-59af-4fcb3f77df94@linux.vnet.ibm.com> Sender: owner-linux-mm@kvack.org List-ID: To: Oleg Nesterov Cc: mhiramat@kernel.org, peterz@infradead.org, srikar@linux.vnet.ibm.com, rostedt@goodmis.org, acme@kernel.org, ananth@linux.vnet.ibm.com, akpm@linux-foundation.org, alexander.shishkin@linux.intel.com, alexis.berlemont@gmail.com, corbet@lwn.net, dan.j.williams@intel.com, jolsa@redhat.com, kan.liang@intel.com, kjlx@templeofstupid.com, kstewart@linuxfoundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, milian.wolff@kdab.com, mingo@redhat.com, namhyung@kernel.org, naveen.n.rao@linux.vnet.ibm.com, pc@us.ibm.com, tglx@linutronix.de, yao.jin@linux.intel.com, fengguang.wu@intel.com, jglisse@redhat.com, Ravi Bangoria Hi Oleg, On 04/09/2018 06:59 PM, Oleg Nesterov wrote: > On 04/04, Ravi Bangoria wrote: >> +static void sdt_add_mm_list(struct trace_uprobe *tu, struct mm_struct *mm) >> +{ >> + struct mmu_notifier *mn; >> + struct sdt_mm_list *sml = kzalloc(sizeof(*sml), GFP_KERNEL); >> + >> + if (!sml) >> + return; >> + sml->mm = mm; >> + list_add(&(sml->list), &(tu->sml.list)); >> + >> + /* Register mmu_notifier for this mm. */ >> + mn = kzalloc(sizeof(*mn), GFP_KERNEL); >> + if (!mn) >> + return; >> + >> + mn->ops = &sdt_mmu_notifier_ops; >> + __mmu_notifier_register(mn, mm); >> +} > and what if __mmu_notifier_register() fails simply because signal_pending() == T? > see mm_take_all_locks(). > > at first glance this all look suspicious and sub-optimal, Yes. I should have added checks for failure cases. Will fix them in v3. Thanks for the review, Ravi > but let me repeat that > I didn't read this version yet. > > Oleg. >