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=0.5 required=3.0 tests=DATE_IN_PAST_03_06, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 EF0F2C32771 for ; Sun, 19 Jan 2020 03:30:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9C4F62072E for ; Sun, 19 Jan 2020 03:30:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PbuQjafa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9C4F62072E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 321C06B0566; Sat, 18 Jan 2020 22:30:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D1D06B0567; Sat, 18 Jan 2020 22:30:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E8516B0568; Sat, 18 Jan 2020 22:30:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0245.hostedemail.com [216.40.44.245]) by kanga.kvack.org (Postfix) with ESMTP id 0AF0E6B0566 for ; Sat, 18 Jan 2020 22:30:01 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id ABFCA8248047 for ; Sun, 19 Jan 2020 03:30:00 +0000 (UTC) X-FDA: 76392954960.15.lace68_575da12af4b33 X-HE-Tag: lace68_575da12af4b33 X-Filterd-Recvd-Size: 3558 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Sun, 19 Jan 2020 03:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Iv6n9Q/k1eXFbCcvnuAFYhME6UiPb/gjtwI6FiGWHlY=; b=PbuQjafa6FNb0jf4Leo51n0ze PRmlAVl5z1ZdMKXv7G8WzQDLeUx/NSuFGo+MqwXrG7HDkYae1p4oEnh9x7xaIytKodpSdON+QIXGk 9aB/4BmlrVDjiiodkKRX1BmVIQc9QLwaqHJn2icSGn22l1FGl8Jj41EPmXavE7FPgg2opgnWOUBdX gIRaoh1MtoSVcJ90zGhhlZ5jYqyNLBFA4AgSEUM+NpmAvD5c7emnIgUgTOZWjNxrGl9yg7fNbj50A p9IN4Rmv3GUcOq+C5+7YvaL/ykoedA+kmUKT74Jm2Ills78XY1DyZWKIYJn9p6h7CEpNwGp+IKDcT tfYpGlzOQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1isxHm-0005Lx-Tp; Sat, 18 Jan 2020 23:13:46 +0000 Date: Sat, 18 Jan 2020 15:13:46 -0800 From: Matthew Wilcox To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: Jeff Layton , Christoph Hellwig , Chris Mason Subject: Re: [RFC v2 0/9] Replacing the readpages a_op Message-ID: <20200118231346.GB5583@bombadil.infradead.org> References: <20200115023843.31325-1-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200115023843.31325-1-willy@infradead.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jan 14, 2020 at 06:38:34PM -0800, Matthew Wilcox wrote: > This is an attempt to add a ->readahead op to replace ->readpages. I've > converted two users, iomap/xfs and cifs. The cifs conversion is lacking > fscache support, and that's just because I didn't want to do that work; > I don't believe there's anything fundamental to it. But I wanted to do > iomap because it is The Infrastructure Of The Future and cifs because it > is the sole remaining user of add_to_page_cache_locked(), which enables > the last two patches in the series. By the way, that gives CIFS access > to the workingset shadow infrastructure, which it had to ignore before > because it couldn't put pages onto the lru list at the right time. > > v2: Chris asked me to show what this would look like if we just have > the implementation look up the pages in the page cache, and I managed > to figure out some things I'd done wrong last time. It's even simpler > than v1 (net 104 lines deleted). I want to discuss whether to change the page refcount guarantees while we're changing the API. Currently, page is allocated with a refcount of 1 page is locked, and inserted into page cache and refcount is bumped to 2 ->readahead is called callee is supposed to call put_page() after submitting I/O I/O completion will unlock the page after I/O completes, leaving the refcount at 1. So, what if we leave the refcount at 1 throughout the submission process, saving ourselves two atomic ops per page? We have to ensure that after the page is submitted for I/O, the submission path no longer touches the page. So the process of converting a filesystem to ->readahead becomes slightly more complex, but there's a bugger win as a result. Opinions?