Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3201187yba; Tue, 16 Apr 2019 06:48:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKF70ggIlPFSl2CW6ZUBCv2DCFVp/HndyyroRMk0zavvunm1iFs+F7FKo4MZrPyf+Snl2m X-Received: by 2002:a63:2983:: with SMTP id p125mr77968857pgp.262.1555422515182; Tue, 16 Apr 2019 06:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555422515; cv=none; d=google.com; s=arc-20160816; b=KTi3jf88Kp5oRFVZs+ejgfKblx6Bu3UdqjqQ5l6TGkh5oX1qg1n/0592nOWpbN0v64 P6IiDjRWbS8Zx7kICXwkNfmSLsmIcUPyAvwEHehixSIrgNTAHdC2MO/iuAC9ZfQsYH5D zw57OYG1eJ/FhPOjcN1/n6WHoIPif8sgJAoFI1dUCYFbNPjq/GIRkT0D7V53VkV/vA0x GpHQ0GuGgeXwscGESnnVlNcZLOLsDFRXQZig0mSMkYmUtFISaMV9MQYnpSbO/lHgSVWn /4xFg9iaOLnP+CFTYLnG1Fl79yaG1MvXhDqWfaWIh0NiAYCX6eWcBtPkfszSXkx81AOf 0WJQ== 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-transfer-encoding :mime-version:references:in-reply-to:date:subject:cc:to:from; bh=rgeNuvJuXBGvLDIQM3tb0bsPHtZK+4OhBnf+76arYR0=; b=vwO+XWhBmmDHQGvA9dm3q+pBC0uh/vXhTuEYo+LhAH+o6Kmcmhak72u1riO7cKsaN2 xW4na51lGvC7hrqx72UKT4ViWOBDA759CPpKXKsboej2QrQvAL4wGHA4dZOa/ULphl4C jdK/M/MEuFOD+nt1lSeYO01iBu8pwBq/L9Dt5mlRydNSgs8qtUZHccTOi6tiPZdetOPi YU+HGhfHlnBUAN4NrggPOWctKwJ/1ezTPwPsj/20E/FQjoUec25WG2JmyEFl8+usJiTH qd3tLDNBdBrGwpm55HX/EpbasaoqimUHBHUi7pVNT5UbKVuTdjSwXXXF6dw6ryYiOL1y VNvQ== 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 a11si34322612pgw.384.2019.04.16.06.48.19; Tue, 16 Apr 2019 06:48:35 -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 S1729587AbfDPNrN (ORCPT + 99 others); Tue, 16 Apr 2019 09:47:13 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59104 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729563AbfDPNrI (ORCPT ); Tue, 16 Apr 2019 09:47:08 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3GDkXZx070765 for ; Tue, 16 Apr 2019 09:47:07 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2rwftphbht-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 16 Apr 2019 09:47:07 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 16 Apr 2019 14:47:04 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 16 Apr 2019 14:46:53 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3GDkqd060686582 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Apr 2019 13:46:52 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DE5414C066; Tue, 16 Apr 2019 13:46:51 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6804E4C046; Tue, 16 Apr 2019 13:46:50 +0000 (GMT) Received: from nimbus.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.33]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 16 Apr 2019 13:46:50 +0000 (GMT) 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 , aneesh.kumar@linux.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 , zhong jiang , Haiyan Song , Balbir Singh , sj38.park@gmail.com, Michel Lespinasse , Mike Rapoport Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, haren@linux.vnet.ibm.com, npiggin@gmail.com, paulmck@linux.vnet.ibm.com, Tim Chen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: [PATCH v12 31/31] mm: Add a speculative page fault switch in sysctl Date: Tue, 16 Apr 2019 15:45:22 +0200 X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190416134522.17540-1-ldufour@linux.ibm.com> References: <20190416134522.17540-1-ldufour@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19041613-0020-0000-0000-000003307064 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19041613-0021-0000-0000-00002182B514 Message-Id: <20190416134522.17540-32-ldufour@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-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 mlxscore=0 impostorscore=0 mlxlogscore=784 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904160093 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This allows to turn on/off the use of the speculative page fault handler. By default it's turned on. Signed-off-by: Laurent Dufour --- include/linux/mm.h | 3 +++ kernel/sysctl.c | 9 +++++++++ mm/memory.c | 3 +++ 3 files changed, 15 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index ec609cbad25a..f5bf13a2197a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1531,6 +1531,7 @@ extern vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address, unsigned int flags); #ifdef CONFIG_SPECULATIVE_PAGE_FAULT +extern int sysctl_speculative_page_fault; extern vm_fault_t __handle_speculative_fault(struct mm_struct *mm, unsigned long address, unsigned int flags); @@ -1538,6 +1539,8 @@ static inline vm_fault_t handle_speculative_fault(struct mm_struct *mm, unsigned long address, unsigned int flags) { + if (unlikely(!sysctl_speculative_page_fault)) + return VM_FAULT_RETRY; /* * Try speculative page fault for multithreaded user space task only. */ diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 9df14b07a488..3a712e52c14a 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1295,6 +1295,15 @@ static struct ctl_table vm_table[] = { .extra1 = &zero, .extra2 = &two, }, +#ifdef CONFIG_SPECULATIVE_PAGE_FAULT + { + .procname = "speculative_page_fault", + .data = &sysctl_speculative_page_fault, + .maxlen = sizeof(sysctl_speculative_page_fault), + .mode = 0644, + .proc_handler = proc_dointvec, + }, +#endif { .procname = "panic_on_oom", .data = &sysctl_panic_on_oom, diff --git a/mm/memory.c b/mm/memory.c index c65e8011d285..a12a60891350 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -83,6 +83,9 @@ #define CREATE_TRACE_POINTS #include +#ifdef CONFIG_SPECULATIVE_PAGE_FAULT +int sysctl_speculative_page_fault = 1; +#endif #if defined(LAST_CPUPID_NOT_IN_PAGE_FLAGS) && !defined(CONFIG_COMPILE_TEST) #warning Unfortunate NUMA and NUMA Balancing config, growing page-frame for last_cpupid. -- 2.21.0