From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86F48C4BA12 for ; Wed, 26 Feb 2020 15:57:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6317321556 for ; Wed, 26 Feb 2020 15:57:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728794AbgBZP5d (ORCPT ); Wed, 26 Feb 2020 10:57:33 -0500 Received: from mga12.intel.com ([192.55.52.136]:20933 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728590AbgBZP53 (ORCPT ); Wed, 26 Feb 2020 10:57:29 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2020 07:57:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,488,1574150400"; d="scan'208";a="231443910" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by orsmga008.jf.intel.com with ESMTP; 26 Feb 2020 07:57:28 -0800 Date: Wed, 26 Feb 2020 07:57:28 -0800 From: Ira Weiny To: Jan Kara Cc: Dave Chinner , Christoph Hellwig , linux-kernel@vger.kernel.org, Alexander Viro , "Darrick J. Wong" , Dan Williams , "Theodore Y. Ts'o" , linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH V4 07/13] fs: Add locking for a dynamic address space operations state Message-ID: <20200226155727.GA22036@iweiny-DESK2.sc.intel.com> References: <20200221004134.30599-1-ira.weiny@intel.com> <20200221004134.30599-8-ira.weiny@intel.com> <20200221174449.GB11378@lst.de> <20200221224419.GW10776@dread.disaster.area> <20200224175603.GE7771@lst.de> <20200225000937.GA10776@dread.disaster.area> <20200226111740.GF10728@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200226111740.GF10728@quack2.suse.cz> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 26, 2020 at 12:17:40PM +0100, Jan Kara wrote: > On Tue 25-02-20 11:09:37, Dave Chinner wrote: > > /me wonders if the best thing to do is to add a ->fault callout to > > tell the filesystem to lock/unlock the inode right up at the top of > > the page fault path, outside even the mmap_sem. That means all the > > methods that the page fault calls are protected against S_DAX > > changes, and it gives us a low cost method of serialising page > > faults against DIO (e.g. via inode_dio_wait()).... > > Well, that's going to be pretty hard. The main problem is: you cannot > lookup VMA until you hold mmap_sem and the inode is inside the VMA. And > this is a fundamental problem because until you hold mmap_sem, the address > space can change and thus the virtual address you are faulting can be > changing inode it is mapped to. So you would have to do some dance like: > > lock mmap_sem > lookup vma > get inode reference > drop mmap_sem > tell fs about page fault > lock mmap_sem > is the vma still the same? > > And I'm pretty confident the overhead will be visible in page fault > intensive workloads... I did not get to this level of detail... Rather I looked at it from a high level perspective and thought "does the mode need to change while someone has the mmap?" My thought is, that it does not make a lot of sense. Generally the user has mmaped with some use case in mind (either DAX or non-DAX) and it seems reasonable to keep that mode consistent while the map is in place. So I punted and restricted the change. Ira > > Honza > > -- > Jan Kara > SUSE Labs, CR