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=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 EA4BCC433DF for ; Thu, 2 Jul 2020 15:16:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A84E1206B7 for ; Thu, 2 Jul 2020 15:16:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eeEdBqeD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A84E1206B7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 236FD6B009C; Thu, 2 Jul 2020 11:16:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E7506B009D; Thu, 2 Jul 2020 11:16:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 125E26B009E; Thu, 2 Jul 2020 11:16:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0047.hostedemail.com [216.40.44.47]) by kanga.kvack.org (Postfix) with ESMTP id F26736B009C for ; Thu, 2 Jul 2020 11:16:58 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B210B824805A for ; Thu, 2 Jul 2020 15:16:58 +0000 (UTC) X-FDA: 76993488516.07.quilt14_431195e26e8a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 8297A1803F9A1 for ; Thu, 2 Jul 2020 15:16:58 +0000 (UTC) X-HE-Tag: quilt14_431195e26e8a X-Filterd-Recvd-Size: 5008 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Jul 2020 15:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593703017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iaHGVjmAmXhp9lutE/R+X9XTXlXuXnf2H5y3xxwJ93o=; b=eeEdBqeDpzUZ2QharGAkPeijprs4unJMHJtTeIShJYlbJ2watqnC5ZPQcUG5odFffKTvyR HQ2ZG0v9YH9i04NT/lhDv69Vn7yfeqz5s6OW2y35A50/DMYC+0HUdhbB5z518CHELrtGvD 0QT2ZFPtyRJZScvEuPky5cYQXE3JOTI= Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-110-eBWNDSDmNBGf8r6wxqx9Zw-1; Thu, 02 Jul 2020 11:16:55 -0400 X-MC-Unique: eBWNDSDmNBGf8r6wxqx9Zw-1 Received: by mail-oo1-f69.google.com with SMTP id f20so4862373oot.7 for ; Thu, 02 Jul 2020 08:16:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iaHGVjmAmXhp9lutE/R+X9XTXlXuXnf2H5y3xxwJ93o=; b=RhyJJYh46IaYtJLINRJOMQtJFA4RjU3AWDHAAr4uFZKVuxjMVB5KpN99C35TVcgXxc Xqtv+PbwvkhhH6BKh+p1v0iUUfjHraLz//i8QxGv3YGjz6WwnjTJsl8NsXC5wbTAAc2h rehbL+KPNQvQLpgHg+vax8oYlGMopvW2/QhHjUYz78qQ+qYpCpR6Vje6iTbthb0b/LqH 8/v6/uvwTS+HMFVYCs6RIrpQJPGzoF/3Ev+KZ4jIlVSAfQ/EjHsQmcg7XVq2x5Imq8RM GChSfGTqOI4b2+HwqX3dBrma/+JIwS80B0u1WxM4/BNCAoPIVoF0nOVwnhMK4wnxy4Nd ytGQ== X-Gm-Message-State: AOAM531CqhqNDpJk7P0SW3Hj7EljuIbyfdn+vOEYlJjvvPMl3SwAWkjL hNYUaWWEZ1Xazu8WbHA0iB8mX9868figJ1FenjuAqLwvRsqvJFpmPagXS4+mExEEveUji1KZXRL JqescpptbuS3LZXDgTfMbov5RcZw= X-Received: by 2002:a05:6830:1c6e:: with SMTP id s14mr22045248otg.58.1593703014903; Thu, 02 Jul 2020 08:16:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxI3bsBzuJ3Kf//oLr+uyYhe2RcCJSWhVflkhZK7zJVGNOpQZUZYdLgArfJLRyL4CcHxYQZONIFKjbIDY2zBQc= X-Received: by 2002:a05:6830:1c6e:: with SMTP id s14mr22045226otg.58.1593703014619; Thu, 02 Jul 2020 08:16:54 -0700 (PDT) MIME-Version: 1.0 References: <20200619155036.GZ8681@bombadil.infradead.org> <20200622003215.GC2040@dread.disaster.area> <20200622181338.GA21350@casper.infradead.org> In-Reply-To: From: Andreas Gruenbacher Date: Thu, 2 Jul 2020 17:16:43 +0200 Message-ID: Subject: Re: [RFC] Bypass filesystems for reading cached pages To: Matthew Wilcox Cc: Dave Chinner , linux-fsdevel , Linux-MM , LKML Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=agruenba@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 8297A1803F9A1 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jun 24, 2020 at 2:35 PM Andreas Gruenbacher wrote: > On Mon, Jun 22, 2020 at 8:13 PM Matthew Wilcox wrote: > > On Mon, Jun 22, 2020 at 04:35:05PM +0200, Andreas Gruenbacher wrote: > > > I'm fine with not moving that functionality into the VFS. The problem > > > I have in gfs2 is that taking glocks is really expensive. Part of that > > > overhead is accidental, but we definitely won't be able to fix it in > > > the short term. So something like the IOCB_CACHED flag that prevents > > > generic_file_read_iter from issuing readahead I/O would save the day > > > for us. Does that idea stand a chance? > > > > For the short-term fix, is switching to a trylock in gfs2_readahead() > > acceptable? > > Well, it's the only thing we can do for now, right? It turns out that gfs2 can still deadlock with a trylock in gfs2_readahead, just differently: in this instance, gfs2_glock_nq will call inode_dio_wait. When there is pending direct I/O, we'll end up waiting for iomap_dio_complete, which will call invalidate_inode_pages2_range, which will try to lock the pages already locked for gfs2_readahead. This late in the 5.8 release cycle, I'd like to propose converting gfs2 back to use mpage_readpages. This requires reinstating mpage_readpages, but it's otherwise relatively trivial. We can then introduce an IOCB_CACHED or equivalent flag, fix the locking order in gfs2, convert gfs2 to mpage_readahead, and finally remove mage_readpages in 5.9. I'll post a patch queue that does this for comment. Thanks, Andreas