[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <ec30042b-da4b-a02b-ee37-6bd99c179e2b@linux.vnet.ibm.com>
Date: Fri, 16 Mar 2018 15:01:05 +0530
From: Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: mhiramat@...nel.org, peterz@...radead.org,
srikar@...ux.vnet.ibm.com, acme@...nel.org,
ananth@...ux.vnet.ibm.com, akpm@...ux-foundation.org,
alexander.shishkin@...ux.intel.com, alexis.berlemont@...il.com,
corbet@....net, dan.j.williams@...el.com,
gregkh@...uxfoundation.org, huawei.libin@...wei.com,
hughd@...gle.com, jack@...e.cz, jglisse@...hat.com,
jolsa@...hat.com, kan.liang@...el.com,
kirill.shutemov@...ux.intel.com, kjlx@...pleofstupid.com,
kstewart@...uxfoundation.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org, mhocko@...e.com,
milian.wolff@...b.com, mingo@...hat.com, namhyung@...nel.org,
naveen.n.rao@...ux.vnet.ibm.com, pc@...ibm.com,
pombredanne@...b.com, rostedt@...dmis.org, tglx@...utronix.de,
tmricht@...ux.vnet.ibm.com, willy@...radead.org,
yao.jin@...ux.intel.com, fengguang.wu@...el.com,
Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>
Subject: Re: [PATCH 5/8] trace_uprobe: Support SDT markers having reference
count (semaphore)
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
Powered by blists - more mailing lists