Received: by 10.213.65.68 with SMTP id h4csp2082537imn; Mon, 2 Apr 2018 00:13:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx49VDMpz7dGXbRlsb+Z/VisZLFq65khL0J5Thv4b47CHTLbtrfEDBmb0qhsh8EbgTRDpazLx X-Received: by 10.99.149.83 with SMTP id t19mr5564299pgn.433.1522653184135; Mon, 02 Apr 2018 00:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522653184; cv=none; d=google.com; s=arc-20160816; b=xCxKFDat+E4i1zE9zYSz2H1KFP+WKlditl4YvUq5b9kJrm9TURv9Rh+FEfn+PXn7rP 6po091JqM5zPjw8ow9kI4CvYFsX4T/6zM3q/pxvrgY4vA4VC2CmEgn4U6p4xfKh8C7hm TJ4uFl/N9YiAY/9dZ7Ysgk4T7GlTkg9YpiWLhXpAW0Ul44WOtgpywmZ6RKVYXTuX2iZX 0069kfAJxBNcWH2FjEgZR0lzh94PUqnIGzLMcKpaS9piBdagN9aSNrjWkyGHlEVSnBAb tt3FssqlZrETpy1ahrYWKv2s96sTO8rmFmhUnFRb0O1x5mDbMgOXW6gYvGga/qDdkRqd i1ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=USK8weOBojMRp/5oYi/VxDiJXwY+fCbzOW6XaF/xbGQ=; b=mrf4TPIUKFdD7K0KkgbZ/4VcRjR2euh68PHM9QL3NqjnwijjANG2IpOyG64SC+KmdY LqbAmOXE0BWbwVHjB85O4zo+c56ovS4NJCoTF+Htrc8VQ4W2KIhPMyMSkLlalVobbBIc ApZl6ZjVXHIhKsIf9ETqJvfjejb/lBeYQ0j7ZZ0Cm9MXX/SCswvjke4MY/oRVwNaCl/s mUdHe/eEVVCGDxHEGt8ZecNjCwv2WKDb+dnKDwXr5LHADizEQwiRX1xGGVN+SPCbtCPJ RiRJ99vQQ7bNKAs3gP1H8qAP3BTNr1YtD2jMY1M8QMtIRBVq4wxHTIjh8cI4UcoOKndI Fu+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=p/cSt4g9; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h18si10303487pfi.31.2018.04.02.00.12.49; Mon, 02 Apr 2018 00:13:04 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=p/cSt4g9; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754276AbeDBHLn (ORCPT + 99 others); Mon, 2 Apr 2018 03:11:43 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:40914 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754155AbeDBHLl (ORCPT ); Mon, 2 Apr 2018 03:11:41 -0400 Received: by mail-io0-f196.google.com with SMTP id e79so16970031ioi.7 for ; Mon, 02 Apr 2018 00:11:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=USK8weOBojMRp/5oYi/VxDiJXwY+fCbzOW6XaF/xbGQ=; b=p/cSt4g9o6kKOmi54b3Qy6lHysCknR9YE/oAvo2mZoKCchvRr8WQIrxQQWO4wE7FBH AeF5IPuuCVr0k0DiEqwnbpCkbu+6fJVHmmK7LaFXSw5rfxXO4vbBZ/Hegexfll/f89Dq coxBtsWPJO7mNGX3QQOJVPANebk1HO9+0NrVV8MW08ajZY0lDKNBzgJU53Ikywbm9Clt 1U1OjFRZ9V1ZIzSspwkqTFzUpB45faOFOhe8Rt2sLqbZdTnGz390v7xxSWOsSw9APQK1 qQdPnp6zYXY1zLYotoPU2g94exnkIdQy+eMx7+sdIr19WB8RNqIqvjguzdMK0EQ0Lsup hMgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=USK8weOBojMRp/5oYi/VxDiJXwY+fCbzOW6XaF/xbGQ=; b=JGis7uMviAATSgYUcebRcYyJSXleokmxnP7t8rDMQ/B1KWxVkcEe/dJ3Epa0rGarXM eVXAQfkEQCy5AFx13w0HHe53gL7JVpTuxRwmUU9WqO/KBKE5uIe+MI+jaCN43VHZ2K/L ZYWXzUkssPaAjQ/7k96CAkkby1N85ujAoVH+w6vj/bwtmG0qmOsOnUBBTjNQpxH6F3JD EDJ+uwFbc9u0GQ8v77p99TKCzi1Mmg9OqaDgzKrqUzLVvqO4GKm0Yj8tsCKO4aNlmM7Q YPZi1zGnia+QdMDCTTI+ZjdOgMOVMm31aCXEjnT+aHf5p5wSVgDzAAq41l3u48hBCNVA 9wuQ== X-Gm-Message-State: AElRT7FdsVeTkXX3RTP6D3ByupUOBLsZJ58RuBL90bTBcxoB3nUDoaBL 1sPcMpbcueuL2VC5A07E0TQ= X-Received: by 10.107.15.89 with SMTP id x86mr7693703ioi.159.1522653099739; Mon, 02 Apr 2018 00:11:39 -0700 (PDT) Received: from rodete-desktop-imager.corp.google.com ([2401:fa00:d:0:7630:de9:f6f2:276f]) by smtp.gmail.com with ESMTPSA id 17sm8009214iom.73.2018.04.02.00.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Apr 2018 00:11:38 -0700 (PDT) Date: Mon, 2 Apr 2018 16:11:33 +0900 From: Minchan Kim To: Ganesh Mahendran Cc: Greg Kroah-Hartman , LKML , Joe Perches , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen Subject: Re: [PATCH v5] ANDROID: binder: change down_write to down_read Message-ID: <20180402071133.GA62369@rodete-desktop-imager.corp.google.com> References: <20180329065424.203172-1-minchan@kernel.org> <20180330012921.GB255979@rodete-desktop-imager.corp.google.com> <20180330100407.GB19140@kroah.com> <20180402063448.GA250086@rodete-desktop-imager.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 02, 2018 at 02:46:14PM +0800, Ganesh Mahendran wrote: > 2018-04-02 14:34 GMT+08:00 Minchan Kim : > > On Fri, Mar 30, 2018 at 12:04:07PM +0200, Greg Kroah-Hartman wrote: > >> On Fri, Mar 30, 2018 at 10:29:21AM +0900, Minchan Kim wrote: > >> > Hi Ganesh, > >> > > >> > On Fri, Mar 30, 2018 at 09:21:55AM +0800, Ganesh Mahendran wrote: > >> > > 2018-03-29 14:54 GMT+08:00 Minchan Kim : > >> > > > binder_update_page_range needs down_write of mmap_sem because > >> > > > vm_insert_page need to change vma->vm_flags to VM_MIXEDMAP unless > >> > > > it is set. However, when I profile binder working, it seems > >> > > > every binder buffers should be mapped in advance by binder_mmap. > >> > > > It means we could set VM_MIXEDMAP in binder_mmap time which is > >> > > > already hold a mmap_sem as down_write so binder_update_page_range > >> > > > doesn't need to hold a mmap_sem as down_write. > >> > > > > >> > > > Android suffers from mmap_sem contention so let's reduce mmap_sem > >> > > > down_write. > >> > > > >> > > Hi, Minchan: > >> > > > >> > > It seems there is performance regression of this patch. > >> > > >> > You mean "This patch aims for solving performance regression" not "This patch > >> > makes performance regression"? > >> > > >> > > > >> > > Do you have some test result of android app launch time or binderThroughput? > >> > > >> > Unfortunately, I don't have any number. The goal is to reduce the number of > >> > call mmap_sem as write-side lock because it makes priority inversion of threads > >> > easily and that's one of clear part I spot that we don't need write-side lock. > >> > >> Please always run the binderThroughput tests when making binder changes > >> (there is a binder test suite in the CTS Android tests), as that ensures > >> that you are not causing performance regressions as well as just normal > >> bug regressions :) > > > > Thanks for the information. I didn't notice that such kinds of tests for > > binder. I will keep it in mind. > > > > Today, I have setup the testing for my phone and found testing was very > > fluctuating even without my patch. It might be not good with my test > > skill. I emulated user's behavior with various touch event. With it, I open > > various apps and play with them several times. Before starting the test, > > I did "adb shell stop && adb shell start && echo 3 > /proc/sys/vm/drop_caches" > > > > Such 15% noise was very easy to make it. > > > > Ganesh, How did you measure? What's the stddev? > > Hi, Minchan: > > Sorry for the late response, a little busy these days. :) > > We have our own test tools to measure app launch time, or you can use > android systrace to get the app launch time. We tested your V1 patch: > https://patchwork.kernel.org/patch/10312057/ > and found app lunch time regression. V1 had a bug with VM_MAYWRITE. Could you confirm it with v5? Please tell me more detail. What apps are slower compared to old? Every apps are slowed with avg 15%? Then, what's the stddev? The reason I'm asking is as I mentioned, it would be caused by rw_semaphore implementation and priority of threads which calls binder operation so I guess it would be not deterministic. When I had an simple experiment, it was very fluctuating as I expected. (the testing enviroment might be not good in my side). If it's real problem on real practice, better fix is not using write_lock of mmap_sem(it's abusing the write-side lock) but should adjust priority, I think. What do you think? Anyway, before the further discussion, we should confirm the root cause. > > I will use binderThroghput tool to test the patch today or tomorrow. > Thanks. I will do.