Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp39712pxf; Tue, 6 Apr 2021 14:21:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJDD0dWNTPZYMCUmrxbQxTuZYR/em+dj4GO1cMy3OatwDt3Wu9re7j99gCBKzZfuLKtYd+ X-Received: by 2002:a17:906:2c1a:: with SMTP id e26mr3695ejh.306.1617744103022; Tue, 06 Apr 2021 14:21:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617744103; cv=none; d=google.com; s=arc-20160816; b=WMflAJT5ICst28ZlaGgzQ+mCLAGwfu/mogHDkxEsRC7l3qJK4tfHHxbUVMjz0w9eW7 hi3fVCiPC0PPqhrtlqcGSsaqvwhx8X8PPDex9hOz+mvzmzYmZthLaJjr9KGJ1iIqpi42 eG3s5pwSi94E4oVrCXVAc+9CgUlzz+GfiiF5PtRbLqeSLSpp3WNeIxAk0HNu9vrfJg+k //C2f06trt4qOgZpCCljTVF4cOZEhyCDaBON+rWCHCAgXK8qOmVht6lAz1I5v99xyVI9 PVe3oQtsk0Lki+rSEiiUBOjGVHbiEdj+/fHlWRIiHLiygzgZaKfawMqFglzab20gP6uc Gh1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=LWR+YTqFCR5vpZkIacTfRHoe6da2srZTT99oDfAeYN4=; b=e2cKKq0n38HK7Se54G18VHMmw8dJTYbtIauChIlekJTH8tpv6vIazk554UgHpGkYMO 4qHfYPOTL4pcJOlpxjoatFPwQBtXAGuokmHgNdjGQu0MCF9pHcnTCVmgO79lMMEMawu6 M1MmWDzuCuylOwjA0/fWyBP897tL+CfKbnQpyy8vZrLBwRTKbeOEA1brDtr6cGioPx9M d3f1EI2fyZy8CruxMsca6uEpTpvAR9nVKqna2tJlF/tqfpzN4HteT30NQOgPHJmDT0u7 wecjOOLbD3I1qe4tJHT7Hwmu+6AnJf1PX29s+TvkMbpCmYHO2E11UnmHbvvaFq2v6+QV eSYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v11si1059508ejj.6.2021.04.06.14.21.18; Tue, 06 Apr 2021 14:21:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343924AbhDFMWD (ORCPT + 99 others); Tue, 6 Apr 2021 08:22:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:39256 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343961AbhDFMV6 (ORCPT ); Tue, 6 Apr 2021 08:21:58 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DA330B165; Tue, 6 Apr 2021 12:21:48 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id AF6701F2B77; Tue, 6 Apr 2021 14:21:48 +0200 (CEST) Date: Tue, 6 Apr 2021 14:21:48 +0200 From: Jan Kara To: Kent Overstreet Cc: Christoph Hellwig , Jan Kara , linux-fsdevel@vger.kernel.org, Matthew Wilcox , linux-ext4@vger.kernel.org Subject: Re: [PATCH 2/3] mm: Provide address_space operation for filling pages for read Message-ID: <20210406122148.GC19407@quack2.suse.cz> References: <20210120160611.26853-1-jack@suse.cz> <20210120160611.26853-3-jack@suse.cz> <20210120162001.GB3790454@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri 02-04-21 17:17:10, Kent Overstreet wrote: > On Wed, Jan 20, 2021 at 04:20:01PM +0000, Christoph Hellwig wrote: > > On Wed, Jan 20, 2021 at 05:06:10PM +0100, Jan Kara wrote: > > > Provide an address_space operation for filling pages needed for read > > > into page cache. Filesystems can use this operation to seriealize > > > page cache filling with e.g. hole punching properly. > > > > Besides the impending rewrite of the area - having another indirection > > here is just horrible for performance. If we want locking in this area > > it should be in core code and common for multiple file systems. > > Agreed. Please see v2 [1] where the indirection is avoided. > But, instead of using a rwsemaphore, why not just make it a lock with two shared > states that are exclusive with each other? One state for things that add pages > to the page cache, the other state for things that want to prevent that. That > way, DIO can use it too... Well, the filesystems I convert use rwsem currently so for the conversion, keeping rwsem is the simplest. If we then decide for a more fancy locking primitive (and I agree what you describe should be possible), then we can do that but IMO that's the next step (because it requires auditing every filesystem that the new primitive is indeed safe for them). Honza [1] https://lore.kernel.org/linux-fsdevel/20210212160108.GW19070@quack2.suse.cz/ -- Jan Kara SUSE Labs, CR