From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751410AbdH3Jcx (ORCPT ); Wed, 30 Aug 2017 05:32:53 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51087 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751242AbdH3Jcw (ORCPT ); Wed, 30 Aug 2017 05:32:52 -0400 Subject: Re: [PATCH v2 14/20] mm: Provide speculative fault infrastructure To: Peter Zijlstra , Anshuman Khandual Cc: "Kirill A. Shutemov" , paulmck@linux.vnet.ibm.com, akpm@linux-foundation.org, ak@linux.intel.com, mhocko@kernel.org, dave@stgolabs.net, jack@suse.cz, Matthew Wilcox , benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, Thomas Gleixner , Ingo Molnar , hpa@zytor.com, Will Deacon , linux-kernel@vger.kernel.org, linux-mm@kvack.org, haren@linux.vnet.ibm.com, npiggin@gmail.com, bsingharora@gmail.com, Tim Chen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org References: <1503007519-26777-1-git-send-email-ldufour@linux.vnet.ibm.com> <1503007519-26777-15-git-send-email-ldufour@linux.vnet.ibm.com> <20170827001823.n5wgkfq36z6snvf2@node.shutemov.name> <507e79d5-59df-c5b5-106d-970c9353d9bc@linux.vnet.ibm.com> <20170829120426.4ar56rbmiupbqmio@hirez.programming.kicks-ass.net> <848fa2c6-dbda-9a1e-2efd-3ce9b083365e@linux.vnet.ibm.com> <20170829134550.t7du5zdssvlzemtk@hirez.programming.kicks-ass.net> <20170830055800.GG32112@worktop.programming.kicks-ass.net> From: Laurent Dufour Date: Wed, 30 Aug 2017 11:32:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170830055800.GG32112@worktop.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17083009-0040-0000-0000-000003D45234 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17083009-0041-0000-0000-000025D4C1CA Message-Id: <12d54f18-6dec-5067-db87-d1a176d5160f@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-08-30_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1708300142 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/08/2017 07:58, Peter Zijlstra wrote: > On Wed, Aug 30, 2017 at 10:33:50AM +0530, Anshuman Khandual wrote: >> diff --git a/mm/filemap.c b/mm/filemap.c >> index a497024..08f3042 100644 >> --- a/mm/filemap.c >> +++ b/mm/filemap.c >> @@ -1181,6 +1181,18 @@ int __lock_page_killable(struct page *__page) >> int __lock_page_or_retry(struct page *page, struct mm_struct *mm, >> unsigned int flags) >> { >> + if (flags & FAULT_FLAG_SPECULATIVE) { >> + if (flags & FAULT_FLAG_KILLABLE) { >> + int ret; >> + >> + ret = __lock_page_killable(page); >> + if (ret) >> + return 0; >> + } else >> + __lock_page(page); >> + return 1; >> + } >> + >> if (flags & FAULT_FLAG_ALLOW_RETRY) { >> /* >> * CAUTION! In this case, mmap_sem is not released > > Yeah, that looks right. Hum, I'm wondering if FAULT_FLAG_RETRY_NOWAIT should be forced in the speculative path in that case to match the semantics of __lock_page_or_retry(). > >> @@ -4012,17 +4010,7 @@ int handle_speculative_fault(struct mm_struct *mm, unsigned long address, >> goto unlock; >> } >> >> + if (unlikely(vma_is_anonymous(vma) && !vma->anon_vma)) { >> trace_spf_vma_notsup(_RET_IP_, vma, address); >> goto unlock; >> } > > As riel pointed out on IRC slightly later, private file maps also need > ->anon_vma and those actually have ->vm_ops IIRC so the condition needs > to be slightly more complicated. Yes I read again the code and lead to the same conclusion.