Received: by 10.213.65.68 with SMTP id h4csp268902imn; Fri, 16 Mar 2018 02:30:14 -0700 (PDT) X-Google-Smtp-Source: AG47ELt8+w551Nsev8sWB2NXKHA+71qQASYdTV3oTyOmQ0l0oAFXnrS8YsouiHlgG2BfQR3P9TBr X-Received: by 10.98.161.10 with SMTP id b10mr991257pff.240.1521192614678; Fri, 16 Mar 2018 02:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521192614; cv=none; d=google.com; s=arc-20160816; b=oZjtujKL/8EP4FphMQ9w/FDnDr8aeM/jjXSWMjQxGfFSbEimj5hJOen6nCZUP1Ydom O5uPqLlVKmvmR3Yt9nrahH6+R8oSTu1B47a6iJ+RgNaU/zfKZMO5E5MMVzHN564ymXEI Wcjl1PezdxFjjtyNgs4Fj/aSWXpBnhOKrO705DAWyopT2cgFrap0XFVJxSRP/33Dz7xE JfIzd3CTGPVoWOg8QC1IwQa8cAV5e8oCCFnqlHvv+0MEKS1B8SHWED9IOuGHPZGxMfY7 Tjv5GtL6e3qTcIbymMHFAW83d6HYT5TBw0t7SniQdOdOG7GiQBrk6VkBP5OGIlYfCPlZ FPOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject:arc-authentication-results; bh=CF2deXUZQC4hVmLH6Om+jCxiSMS+ZbH8zAyKqPJZ1ww=; b=roQKIXEACo9cYCJXYw4vBBPnvQv1zLKQns8XKu450j1wnh1arCrJKyqlabArA/FWZz V9uN+x/nswmBwaI4zyAKzVH5C8DQ5kYgEXlUgp0P6KJmZtRGC6/UxKOO9NyFlMo6Y4+/ P1wUbbIxYlq2DfxRglSFKjWm+IMs40K8V00i+KcGwE0vCAZkVxfmRrWDqAgc03TrNeaV 5sK5BPzbwEIuOkANGEJnvUeNVoxB4sC/EdmM8orVBiLEgbtz34T3FJxowgo0TgcOC8Xr 4Uy2CzkfYRa5s5OKGLh/CSpuebeddBflkyUXJJjdqoKGrB0VPEx+/vN09GPGz5pHmZax GVpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16-v6si5920381pli.408.2018.03.16.02.30.00; Fri, 16 Mar 2018 02:30:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751916AbeCPJ24 (ORCPT + 99 others); Fri, 16 Mar 2018 05:28:56 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51634 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750793AbeCPJ2y (ORCPT ); Fri, 16 Mar 2018 05:28:54 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2G9QTxx091687 for ; Fri, 16 Mar 2018 05:28:54 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gr9fkme63-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Fri, 16 Mar 2018 05:28:53 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 16 Mar 2018 09:28:52 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 16 Mar 2018 09:28:48 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2G9Smji32178288; Fri, 16 Mar 2018 09:28:48 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E8062A4040; Fri, 16 Mar 2018 09:21:35 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 099BDA405D; Fri, 16 Mar 2018 09:21:27 +0000 (GMT) Received: from [9.79.219.128] (unknown [9.79.219.128]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 16 Mar 2018 09:21:26 +0000 (GMT) Subject: Re: [PATCH 5/8] trace_uprobe: Support SDT markers having reference count (semaphore) To: Oleg Nesterov Cc: mhiramat@kernel.org, peterz@infradead.org, srikar@linux.vnet.ibm.com, 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, gregkh@linuxfoundation.org, huawei.libin@huawei.com, hughd@google.com, jack@suse.cz, jglisse@redhat.com, jolsa@redhat.com, kan.liang@intel.com, kirill.shutemov@linux.intel.com, kjlx@templeofstupid.com, kstewart@linuxfoundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mhocko@suse.com, milian.wolff@kdab.com, mingo@redhat.com, namhyung@kernel.org, naveen.n.rao@linux.vnet.ibm.com, pc@us.ibm.com, pombredanne@nexb.com, rostedt@goodmis.org, tglx@linutronix.de, tmricht@linux.vnet.ibm.com, willy@infradead.org, yao.jin@linux.intel.com, fengguang.wu@intel.com, Ravi Bangoria References: <20180313125603.19819-1-ravi.bangoria@linux.vnet.ibm.com> <20180313125603.19819-6-ravi.bangoria@linux.vnet.ibm.com> <20180315150156.GA19767@redhat.com> From: Ravi Bangoria Date: Fri, 16 Mar 2018 15:01:05 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180315150156.GA19767@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18031609-0020-0000-0000-00000405DDE2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031609-0021-0000-0000-00004299E987 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-16_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803160115 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/15/2018 08:31 PM, Oleg Nesterov wrote: > On 03/13, Ravi Bangoria wrote: >> +sdt_update_ref_ctr(struct mm_struct *mm, unsigned long vaddr, short d) >> +{ >> + void *kaddr; >> + struct page *page; >> + struct vm_area_struct *vma; >> + int ret = 0; >> + unsigned short orig = 0; >> + >> + if (vaddr == 0) >> + return -EINVAL; >> + >> + ret = get_user_pages_remote(NULL, mm, vaddr, 1, >> + FOLL_FORCE | FOLL_WRITE, &page, &vma, NULL); >> + if (ret <= 0) >> + return ret; >> + >> + kaddr = kmap_atomic(page); >> + memcpy(&orig, kaddr + (vaddr & ~PAGE_MASK), sizeof(orig)); >> + orig += d; >> + memcpy(kaddr + (vaddr & ~PAGE_MASK), &orig, sizeof(orig)); >> + kunmap_atomic(kaddr); > Hmm. Why memcpy? You could simply do > > kaddr = kmap_atomic(); > unsigned short *ptr = kaddr + (vaddr & ~PAGE_MASK); > *ptr += d; > kunmap_atomic(); Yes, that should work. Will change it. Thanks for the review, Ravi