From patchwork Thu May 17 11:06:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Dufour X-Patchwork-Id: 10406437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 413DC602C2 for ; Thu, 17 May 2018 11:08:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F3A5288E0 for ; Thu, 17 May 2018 11:08:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43D82288E2; Thu, 17 May 2018 11:08:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D86F6288E0 for ; Thu, 17 May 2018 11:08:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 960BD6B04C9; Thu, 17 May 2018 07:07:49 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8E7086B04CB; Thu, 17 May 2018 07:07:49 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 69EFA6B04CC; Thu, 17 May 2018 07:07:49 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f198.google.com (mail-qk0-f198.google.com [209.85.220.198]) by kanga.kvack.org (Postfix) with ESMTP id 397226B04C9 for ; Thu, 17 May 2018 07:07:49 -0400 (EDT) Received: by mail-qk0-f198.google.com with SMTP id 190-v6so3557519qkf.16 for ; Thu, 17 May 2018 04:07:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:in-reply-to:references:message-id; bh=h9LmB9pOtsRGWNCYLx+GpdbSpgLQo7+oQP3Xil94HAU=; b=cEDHsa2A6PJWESQMMTzJ08M/n5GbreSX84s99qmf8nKWF6aXwBq/EBLBa011K3r5pi +e7hCSwe9nOXsQRHHu0+bTzIxPHed9adb3C/hrhhGoe/EmIIoO/ghLZi4X5gD7flhwU5 Pccv/OVmOJdat1620gFaL88FsdSGLTeoT/QG1O48YdG57YrkkEu7iOJbyfdMyTU0wiio 3AG/qrxLllpC76rj8MY6UsTFTRPLvwlBt02j6fdvZnPiMLxVUiNc2HlbgRfGRIzCRlTL ge4dmZIdanX4MS6E6W2v14du1DQ0Jp/BxQXlEWZKt+Sz/Cy4BlgChkK/a6DWX7orz8Ce Ijlg== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of ldufour@linux.vnet.ibm.com) smtp.mailfrom=ldufour@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: ALKqPwfjFZyyrsOes6Efz2xwooqCOl4CJ97Ep525xuLpGoSe9mzO8wpL GDcVFxqw+0v8msgHjQYGMNWqr729bHLalFioL0GkBdXipqyTdu5ulgSpwKbdcw4ac1aLHxGFEVV 5x5KKMIriqliej1owkej5VO4sYDGBNA1mIJyzAf3biWDLgHBeH5V0x+sETSBunzI= X-Received: by 2002:a37:5184:: with SMTP id f126-v6mr4277926qkb.265.1526555269011; Thu, 17 May 2018 04:07:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqZ3Stt6VbwAKQu25p2NiQWhHo/NEmgNjqONNbjmetkNTFEYaQ4W93Vf55QmLPAsiUuHI9F X-Received: by 2002:a37:5184:: with SMTP id f126-v6mr4277890qkb.265.1526555268382; Thu, 17 May 2018 04:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526555268; cv=none; d=google.com; s=arc-20160816; b=I64xG7rfBkmCa1u4KYbAREIWsyyVRQCI0H+9nq9lXzLxjctWfzWzIuoyFXVnu/6Qif mJqiYvMZ+Lm2OY1wT/aMbMXXPjynU/4UQOJYp647VmtXuT+OiRRmrFNh6lzaemKDxBRl NXDJ91H+D4FTB81rGFIMkMdYBgpEFV3CJwI5Jotg/VvmhNr9KIzypWeNjKgblmvs+GTl pMT2uITMDSdQ0gEM5h4xSIj0jx505q3hnZgNB058/9MK7QMfKzhC/g4Rr7exR8P3Pf2y ZetMVeUTm1RCvKCVM0Gz7CjQkOmjaToANK8Y5lwoYSu7OukD2KDn/ElkI3OtSkFofeIe qv4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from :arc-authentication-results; bh=h9LmB9pOtsRGWNCYLx+GpdbSpgLQo7+oQP3Xil94HAU=; b=PleOrAzQn++FIQ2jYK00r8DPvoep8IKb+8++C50uHx7oFi848gMlDBaTXzFSKAaROS OKt8EAAFtz0/eLjyBeOfF2CQ0z3OtZvVAHerhKj7/Kbvzs+xoos7CzpeZ/DSxDBStyXM Iuna+8WlSJcZ4w8kQ6Zz5wbdc8KA+1nunMQekiwW3URgS0NKFH+pmVB6VrWr8XHBAz4V NUFYeFy6EgdrfJW3fl7RJMeB1RI3j9v0X762N4VaOqEANs0Vl3FGS+kMaZVbfOpDmXoj /XB3VL/HK2YzxwX3/J7CG6XMVQ6N2m5KGiKkAgIdmUIV1TKdKoe1XfIVCqsk+HJGV9UL SUDw== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of ldufour@linux.vnet.ibm.com) smtp.mailfrom=ldufour@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id f12-v6si903434qke.216.2018.05.17.04.07.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 May 2018 04:07:48 -0700 (PDT) Received-SPF: neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of ldufour@linux.vnet.ibm.com) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of ldufour@linux.vnet.ibm.com) smtp.mailfrom=ldufour@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4HB4BdS022828 for ; Thu, 17 May 2018 07:07:47 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2j187ph2uf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 May 2018 07:07:47 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 17 May 2018 12:07:44 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 17 May 2018 12:07:36 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4HB7Z6d7733550; Thu, 17 May 2018 11:07:35 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6FB734C04A; Thu, 17 May 2018 11:59:24 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 269BB4C050; Thu, 17 May 2018 11:59:23 +0100 (BST) Received: from nimbus.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.33]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 17 May 2018 11:59:23 +0100 (BST) From: Laurent Dufour To: akpm@linux-foundation.org, mhocko@kernel.org, peterz@infradead.org, kirill@shutemov.name, ak@linux.intel.com, dave@stgolabs.net, jack@suse.cz, Matthew Wilcox , khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, Thomas Gleixner , Ingo Molnar , hpa@zytor.com, Will Deacon , Sergey Senozhatsky , sergey.senozhatsky.work@gmail.com, Andrea Arcangeli , Alexei Starovoitov , kemi.wang@intel.com, Daniel Jordan , David Rientjes , Jerome Glisse , Ganesh Mahendran , Minchan Kim , Punit Agrawal , vinayak menon , Yang Shi Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, haren@linux.vnet.ibm.com, npiggin@gmail.com, bsingharora@gmail.com, paulmck@linux.vnet.ibm.com, Tim Chen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: [PATCH v11 26/26] arm64/mm: add speculative page fault Date: Thu, 17 May 2018 13:06:33 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526555193-7242-1-git-send-email-ldufour@linux.vnet.ibm.com> References: <1526555193-7242-1-git-send-email-ldufour@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18051711-0008-0000-0000-000004F77992 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18051711-0009-0000-0000-00001E8BEE07 Message-Id: <1526555193-7242-27-git-send-email-ldufour@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-17_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-1805170100 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Mahendran Ganesh This patch enables the speculative page fault on the arm64 architecture. I completed spf porting in 4.9. From the test result, we can see app launching time improved by about 10% in average. For the apps which have more than 50 threads, 15% or even more improvement can be got. Signed-off-by: Ganesh Mahendran [handle_speculative_fault() is no more returning the vma pointer] Signed-off-by: Laurent Dufour --- arch/arm64/mm/fault.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 91c53a7d2575..fb9f840367f9 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -411,6 +411,16 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr); /* + * let's try a speculative page fault without grabbing the + * mmap_sem. + */ + fault = handle_speculative_fault(mm, addr, mm_flags); + if (fault != VM_FAULT_RETRY) { + perf_sw_event(PERF_COUNT_SW_SPF, 1, regs, addr); + goto done; + } + + /* * As per x86, we may deadlock here. However, since the kernel only * validly references user space from well defined areas of the code, * we can bug out early if this is from code which shouldn't. @@ -460,6 +470,8 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, } up_read(&mm->mmap_sem); +done: + /* * Handle the "normal" (no error) case first. */