Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3202926yba; Tue, 16 Apr 2019 06:50:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJ1adkEjtO29kRlxirM4tkfeXJqBBeQWxTnSfDtZ1J5Rs7EmPopWX83hENzo+UIZOaBa4V X-Received: by 2002:a63:5f05:: with SMTP id t5mr74032750pgb.176.1555422632487; Tue, 16 Apr 2019 06:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555422632; cv=none; d=google.com; s=arc-20160816; b=R59EusUxiQ171NNKXOn1U0+or6fMgIlkj7lTZe1nL2m8+SJIwtmYE9IDU6/rkUYB+3 WHLJR4PAI+1EHmCGwaWF7t82IUI5sGJQ+V+r/lchN92t/DqBt2UxikwTlH4/b6hdv+1d Xxjl17DDsVEZUKOzUMbJ8IFpVJWJfoHrmDcHcLyiCkfx1mExZ1r8KErwZyTxubq77NQM GK6xeMOhlgcrMNk7GK9mZ+AUijCT4DdlbKAMmG8vMJ8ZdlH0PGs7deeXm245s5177vcZ Qdf4l7ZL7f+vZDwEtn7SvMYQJR3fZvlQiPz+pCy3lyD1P43P1yrej/NJIsnR+vjTr95d I2mA== 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=Jz5rqUkE6WFM4DKQsFaVvFygOBtBuOfuq1p+t1n4dxE=; b=RsRfe7hNlMD0cm6qTZSqda7NHO0vgnKxPj/pwrHeHEQI9DLFHMnkhuPbIs8nuXvCTT QtTeFfMTp8sQVtUvUeWE9/v7IXTqkvILbaDJJxE1wJ61FgutQjnshSjIg9OlygALiLw+ gAQzAr76QErlYn+YjKVL2NLk/rT8iU96s7mgLQxLTM8SRJZbrXvIsPIB5+eR4HtMgtEf JB+EhB53F2Y47Qf6LxoO2EmgsWvIx91XM9HVFwxnFQ3RF20TNA1/jc8vqn29wTpvhTPY 0KXhO954WambfD+JsisdlsRP6QSPI0C0t3qFBw2uTGnGgypEt+y6nexRJJ2oS2xFrwUm YdUA== 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 p66si44924277pfp.228.2019.04.16.06.50.16; Tue, 16 Apr 2019 06:50:32 -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 S1729552AbfDPNrG (ORCPT + 99 others); Tue, 16 Apr 2019 09:47:06 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:46266 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728261AbfDPNrG (ORCPT ); Tue, 16 Apr 2019 09:47:06 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3GDkQCP100018 for ; Tue, 16 Apr 2019 09:47:04 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2rwdvq702j-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 16 Apr 2019 09:47:03 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 16 Apr 2019 14:46:43 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) 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:33 +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 x3GDkVc961145266 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Apr 2019 13:46:31 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 80BDA4C050; Tue, 16 Apr 2019 13:46:31 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 102364C046; Tue, 16 Apr 2019 13:46:30 +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:29 +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, Vinayak Menon Subject: [PATCH v12 23/31] mm: don't do swap readahead during speculative page fault Date: Tue, 16 Apr 2019 15:45:14 +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-0008-0000-0000-000002DA6FB6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19041613-0009-0000-0000-00002246A83F Message-Id: <20190416134522.17540-24-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=937 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 Vinayak Menon faced a panic because one thread was page faulting a page in swap, while another one was mprotecting a part of the VMA leading to a VMA split. This raise a panic in swap_vma_readahead() because the VMA's boundaries were not more matching the faulting address. To avoid this, if the page is not found in the swap, the speculative page fault is aborted to retry a regular page fault. Reported-by: Vinayak Menon Signed-off-by: Laurent Dufour --- mm/memory.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mm/memory.c b/mm/memory.c index 6e6bf61c0e5c..1991da97e2db 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2900,6 +2900,17 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) lru_cache_add_anon(page); swap_readpage(page, true); } + } else if (vmf->flags & FAULT_FLAG_SPECULATIVE) { + /* + * Don't try readahead during a speculative page fault + * as the VMA's boundaries may change in our back. + * If the page is not in the swap cache and synchronous + * read is disabled, fall back to the regular page + * fault mechanism. + */ + delayacct_clear_flag(DELAYACCT_PF_SWAPIN); + ret = VM_FAULT_RETRY; + goto out; } else { page = swapin_readahead(entry, GFP_HIGHUSER_MOVABLE, vmf); -- 2.21.0