Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp127140ybi; Tue, 2 Jul 2019 17:33:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsErbfusAeTmHhjZgtQLwcoRThPL7OyPvptdXHCkxPujZZ21cBUSCWtu/SlPk7118B49AB X-Received: by 2002:a63:2f44:: with SMTP id v65mr32876754pgv.185.1562114010250; Tue, 02 Jul 2019 17:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562114010; cv=none; d=google.com; s=arc-20160816; b=T3I3OWR4n1gqMbeqvwnp3vDMASsPBsAwWPNYf4Md+TQtirqvIkPRp7w50lqWy8qvTN 9Wdf9UVZx3Qjs/jzCD0nSoO0V8MMnf7hHyH6G6ZDpb8eFC+INyLt8g5LfFmkVw3PIG0L scDiA4SPzgS+FMhSN5IWh6C2e4FuMuRUI69YhRFSyx0ZWK4tTUOwEG07LgLFSmMbCDNV blojt6QfEh2Ijw4ROB0lK6cnGiwrFiFhjrOtZ8wt5AOoh7bgWt/W+LA0H+/8MozOPUHB NAs1aFowQPmfQV5aHAXelFB2VygBr+A+fA4LqpvJpwC7/k1TPEIQGmwIVLPTkLKszPsX thjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ZXcSaivLBse0FFf2ctO/vkXxTGh9DxaocpQVfdLoLhY=; b=M3shWmu8U8jPknvn3V4tPsUj+SFwpU6Vzc8dumh0TetTnbBWNpDbWcsmuvqmn5OzP+ k7mkWu30XUdKCzAJ6VCD1SgDHv05OkGMudkfebVmQnhAhWW50sKbz7Xwt8XpkEbMYf7I DrAdD081pQK5oVWkIuKt2rTplbfJx/Q1/DLz47o+AgFOSndBN0Rt19o30z5s+cHg2IAW 5fhUr8iryGmvxoSqPffmbNtMzM0dTTNKxbGMpIiPHGzHAZw6jvoLM5jU1/U+cHAFK2Tm CjLozfcPRkz4YipfSBBxF0Z6Gf3+9fnXBfou2hAtwjp6dlJy1IEf/zTayK3pwNjSeGtS jIoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RUqiuvk5; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cf16si359491plb.346.2019.07.02.17.33.15; Tue, 02 Jul 2019 17:33:30 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RUqiuvk5; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727172AbfGCAbf (ORCPT + 99 others); Tue, 2 Jul 2019 20:31:35 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:42523 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726930AbfGCAbe (ORCPT ); Tue, 2 Jul 2019 20:31:34 -0400 Received: by mail-ed1-f65.google.com with SMTP id z25so290971edq.9; Tue, 02 Jul 2019 17:31:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ZXcSaivLBse0FFf2ctO/vkXxTGh9DxaocpQVfdLoLhY=; b=RUqiuvk5AXV5I5ft6eTyLmR+50TxxAHEbh5RUXy9WxrZUs+fYtaZ+E6l8tcroswlKp +BYxwkQTCxhVX2mBpTDi/tnQ6N6iXOk4VJdgCMLecTRQjj0PNLhvRZSFy5qTxAjrUoZr Or2MpOdjjsoTr7SphxentppPilrsV779srsW4zxu72YOawstxJKLcA++bumylNQKRYpD SlnH/WQROmdN3sBj1QjyXZiEYWyZHxaEcITpC6AuLUdC0rJfrKYqisQ5PEpZPUcWBhjI Nuu6ZEqLepGpx0nCV0FrHUrVYirL71OGyt0HeO2g1BDeyGsRkJyh0OJSrFYdm6sWSB/4 HlUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZXcSaivLBse0FFf2ctO/vkXxTGh9DxaocpQVfdLoLhY=; b=lcrjBSCe1DsNNTDNzDx1KaNY+bc9X5rxvmS6PZjcMosr4RyiodxUTMenAEUNu1cDCI zGGL9C5Xs+sn2X5B2yk+9enX/A3hckdGxuOCEN5pYFESwgVznsyD3OfUVV4zdQyHrEBC ZvDU9v494IVN0DYeXs7z7+cSTU59Prsdsqf8z+EZpxUQDijolTXHknGyilVQc0pdUEFw CYVnz5ex/Mw5hm1QouhZTKl1iAEymoizxTdfyMmDU+WAmWQR9ehdS811cszmwHXH7uR6 wwIghSDAc4OhDfLmnN7DpFDKJcNSwHuzuW71Ik+tLKahnfZxqQOZUEfjJ7t7ISpgjuLA QKmg== X-Gm-Message-State: APjAAAW9qiQRn83FjfyzeQY2BoaNb14yN7UNNyCBwO5p3PmNer5crxHz 6yiE77sBhTtBIbWXFCGbSe0= X-Received: by 2002:a17:906:8053:: with SMTP id x19mr31237606ejw.306.1562112290271; Tue, 02 Jul 2019 17:04:50 -0700 (PDT) Received: from [10.68.217.182] ([217.70.211.18]) by smtp.gmail.com with ESMTPSA id k11sm159289edq.54.2019.07.02.17.04.47 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jul 2019 17:04:49 -0700 (PDT) Subject: Re: pagecache locking To: Dave Chinner , Jan Kara Cc: Amir Goldstein , Linus Torvalds , Kent Overstreet , Dave Chinner , "Darrick J . Wong" , Christoph Hellwig , Matthew Wilcox , Linux List Kernel Mailing , linux-xfs , linux-fsdevel , Josef Bacik , Alexander Viro , Andrew Morton References: <20190612162144.GA7619@kmo-pixel> <20190612230224.GJ14308@dread.disaster.area> <20190613183625.GA28171@kmo-pixel> <20190613235524.GK14363@dread.disaster.area> <20190617224714.GR14363@dread.disaster.area> <20190619103838.GB32409@quack2.suse.cz> <20190619223756.GC26375@dread.disaster.area> From: Boaz Harrosh Message-ID: <3f394239-f532-23eb-9ff1-465f7d1f3cb4@gmail.com> Date: Wed, 3 Jul 2019 03:04:45 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190619223756.GC26375@dread.disaster.area> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/06/2019 01:37, Dave Chinner wrote: <> > > I'd prefer it doesn't get lifted to the VFS because I'm planning on > getting rid of it in XFS with range locks. i.e. the XFS_MMAPLOCK is > likely to go away in the near term because a range lock can be > taken on either side of the mmap_sem in the page fault path. > <> Sir Dave Sorry if this was answered before. I am please very curious. In the zufs project I have an equivalent rw_MMAPLOCK that I _read_lock on page_faults. (Read & writes all take read-locks ...) The only reason I have it is because of lockdep actually. Specifically for those xfstests that mmap a buffer then direct_IO in/out of that buffer from/to another file in the same FS or the same file. (For lockdep its the same case). I would be perfectly happy to recursively _read_lock both from the top of the page_fault at the DIO path, and under in the page_fault. I'm _read_locking after all. But lockdep is hard to convince. So I stole the xfs idea of having an rw_MMAPLOCK. And grab yet another _write_lock at truncate/punch/clone time when all mapping traversal needs to stop for the destructive change to take place. (Allocations are done another way and are race safe with traversal) How do you intend to address this problem with range-locks? ie recursively taking the same "lock"? because if not for the recursive-ity and lockdep I would not need the extra lock-object per inode. Thanks Boaz