Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp10869ybf; Wed, 26 Feb 2020 07:57:57 -0800 (PST) X-Google-Smtp-Source: APXvYqxnSUzlHD8DBw8ZdQOfP1jpQ7BgvKO5eSJII4jhdBXvCyCgYY537X3JxzXpWBgNcX6DZuop X-Received: by 2002:a05:6808:9ba:: with SMTP id e26mr3734234oig.81.1582732677833; Wed, 26 Feb 2020 07:57:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582732677; cv=none; d=google.com; s=arc-20160816; b=I63F5Rdni7ZaVoyw2JZYHsnlLAKAvj/jPJwJLT74i/EKTwll+hJP03m6f/XMXbc+aW /9xOs01+Nl0mplczw4j6yI+10dzSAi8MyqDFzik6c+pa6/eAruY3D1pDfezIAguBWH/J Q/EhXuDQFzhurGDF1RuHjeGzF0cjGli/AcaUMFo/BU6/QIDQblSzNvVfYOWcB4pKOpzi f/Vmx0LztGedvRmjBPYJfff81SrAQdaFM/idRaWLOoJ41vAjinDVUbdBt2Ij73ixlKq6 wf9MaB/Nz8bqbd3teQQSCztB4ea/FhtVhodtqmyQanWEnb4ouFmmouc7QD2dvKX9TEQG Aomg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=UVDCnCD7iHFSFLdE0x4ZtmJXlpBVKDPsKwKhfUBpBNw=; b=dhTOJcZtB7e+t/0jLwRqi/ShD2uftTnE6ETEzZXQJqo2mzOKdUrULR25r30B4oiOae de3keKHzgukc+eRvqqMQud0izqcbbT6O/eopvaJgvQYQHWsZK4SJ9ltd98MQMkfmRf0O +f5Uys1MdJZGm4JlpzESBoaGOH5jaKow+m+E/HRfR8G1pqIBsEsGCwj/BcqXWsDiJZZS sIV6ei3HkvUa4CdidY7rHOuychx/lfo16ZYGUdx0csaXAbLfPPNtjAsuCCTJG/M01Mdm 2I8WByO10V5WA4IOfKI2qWw4BYKDEOtmwpNUqupqmcub1V/1UrhoqSo1UGkHcPTJl7sj cZJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17si1552240otr.320.2020.02.26.07.57.46; Wed, 26 Feb 2020 07:57:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728743AbgBZP5c (ORCPT + 99 others); Wed, 26 Feb 2020 10:57:32 -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-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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