Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4080199imj; Tue, 12 Feb 2019 09:25:27 -0800 (PST) X-Google-Smtp-Source: AHgI3IZChOozfchAeC1tL1JBdXoaEz9hmfYzomPET/loYsKREMrxwNo6JbBitUhPgPnLsYRvM+Kx X-Received: by 2002:a62:2c81:: with SMTP id s123mr4937398pfs.174.1549992327755; Tue, 12 Feb 2019 09:25:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549992327; cv=none; d=google.com; s=arc-20160816; b=Bieyf1Nqidx3x68DbukKN/4+fbUpjC4rXpVQh3a7SpHdh4qhlU+AQu8/PuZo7r8Omy pQqKWeHWfyP3gtQrELIw1jRKHT3SyIqC13QZhwVeWnXZZKB07rzDFsEzcmkW2fwtWFUC RE/xMrO6nMl5ntTSVIO7DlHtne1bCw2U4AjV8HYm4Q3ReT2f+uTMVbg2J/M7TvRHSQVi ZJvMWZh+jx3tBlRNA1JUadIirS5RxUFV4/QW6zNTPSusYlaScB8+6GJIeiTDo8yda+wX hBXtCfrB6TDxRM4nvQSIHBfiizta+rpyjt4EQ1QqLvp4h+f93Zcf2jljRVKIcw2Q8f1/ n8pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=u5yVrmcqLQyUPSMbbYCxR9JAtuOplVrqP6Ol1t45LIw=; b=MXKQL3PhZOVNGhe6dTygitT7UsKNFUuT1UDmAFjc0WG32aq5hPp0T1pnMxPWHpJG+T UeuCv3RfFBHPIdeGvTmYu/Qns8iEBluovTiugLcZp6KWVuN/zDMjhunTVFliR34w3mnS oV4EDbI6P2+5Ay9YyWtNHU9xMuY56cZHsDJvDOSi8yS/LVsziw8P3nep+CCUfphI79j8 3yJRKAWXwLLvTd8hkOlbrBx1wX4WSGu+NacclRUSQlzT5SmoPgMSbBHSgqZ4cE6lLWL7 PeVyW2mE5xtDOujfrNjqKEX2LGUONMe2lu67cOcBuwnRY3zreWnmKBQFGBGS2FhO27Fz J6JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=INsI1v2h; 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 b1si4297304plc.332.2019.02.12.09.24.30; Tue, 12 Feb 2019 09:25:27 -0800 (PST) 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=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=INsI1v2h; 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 S1731176AbfBLQzW (ORCPT + 99 others); Tue, 12 Feb 2019 11:55:22 -0500 Received: from a9-46.smtp-out.amazonses.com ([54.240.9.46]:42540 "EHLO a9-46.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727986AbfBLQzW (ORCPT ); Tue, 12 Feb 2019 11:55:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1549990521; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=u5yVrmcqLQyUPSMbbYCxR9JAtuOplVrqP6Ol1t45LIw=; b=INsI1v2hT/d5BvFY22/rKInWGEM2LiJkNygvZpkBu6ryWwFKRqJgI4wiS4zAJvBQ pxoemWBqjEnQ9ioE+c19sSEi5BeZDpwlK6at4cUE8PHAEONO79kt2g9H0sQ3O9WvTyP YQuOEbq5MeRa1glMsh/ceEMpmDICdDL7CngAipak= Date: Tue, 12 Feb 2019 16:55:21 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Jan Kara cc: Jason Gunthorpe , Dan Williams , Matthew Wilcox , Ira Weiny , Dave Chinner , Doug Ledford , lsf-pc@lists.linux-foundation.org, linux-rdma , Linux MM , Linux Kernel Mailing List , John Hubbard , Jerome Glisse , Michal Hocko Subject: Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA In-Reply-To: <20190212163433.GD19076@quack2.suse.cz> Message-ID: <01000168e2a26936-eb7cef59-9772-4a76-b7f3-a7fdc864fa72-000000@email.amazonses.com> References: <20190211102402.GF19029@quack2.suse.cz> <20190211180654.GB24692@ziepe.ca> <20190211181921.GA5526@iweiny-DESK2.sc.intel.com> <20190211182649.GD24692@ziepe.ca> <20190211184040.GF12668@bombadil.infradead.org> <20190211204945.GF24692@ziepe.ca> <20190211210956.GG24692@ziepe.ca> <20190212163433.GD19076@quack2.suse.cz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2019.02.12-54.240.9.46 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Feb 2019, Jan Kara wrote: > > Isn't that already racy? If the mmap user is fast enough can't it > > prevent the page from becoming freed in the first place today? > > No, it cannot. We block page faulting for the file (via a lock), tear down > page tables, free pages and blocks. Then we resume faults and return > SIGBUS (if the page ends up being after the new end of file in case of > truncate) or do new page fault and fresh block allocation (which can end > with SIGBUS if the filesystem cannot allocate new block to back the page). Well that is already pretty inconsistent behavior. Under what conditions is the SIGBUS occurring without the new fault attempt? If a new fault is attempted then we have resource constraints that could have caused a SIGBUS independently of the truncate. So that case is not really something special to be considered for truncation. So the only concern left is to figure out under what conditions SIGBUS occurs with a racing truncate (if at all) if there are sufficient resources to complete the page fault.