Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp638951pxu; Fri, 11 Dec 2020 10:32:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHQjue76cOHUEUZgpiWXc7L7HzQDC3TV/kHvFGASL463pO5jzRGLJ8akLAQDUNCQGztp2t X-Received: by 2002:a17:906:1955:: with SMTP id b21mr12115721eje.236.1607711562837; Fri, 11 Dec 2020 10:32:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607711562; cv=none; d=google.com; s=arc-20160816; b=Nxp5j1us/35Ud8bPhpH8BcpZR+aNht1fioeHAR/ilJWRMnjOISfuzfm24u92M4idES 5CRbY8qTUe54h5QACce2A3qvwbp16D3mn5IrnXMVxzBjf/6AhzB2fjBQ0HoYYtP6+YM9 vduXWXiHTUzLsY3uvl3lA0aFVEpP8AUuxyAJRuGSSsTijgxTnrU1KZqYWbab9nJ2IcPF s2enTp1deZC7DYbeaQcr3B0X6jdPU2w4xMzJvsq3CD9kcaNfG2S6K9j4FgDuSaefjnjR 3gyyCWzbbx9ow/K7JJfmrsTacBTUeVG6vTh18syKvMTxRGufk1gI8bc2lmDo/uq69Cqd S3Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WW/IgNhybzf9n43eMLzqyKuFaTrBzPIKMpnR7SzERUk=; b=Z0dGVTfD5QdobYj0LKBe96SsotXKmxm7bqEEZcf9Z978WlQWZvprCodDvc+3NpDdkq zuQ/Wo/QabTeHoh+R+rpbqszg5++ZZogVy5fbXhZ5NVFXWt9+LulhAssw2h0p/Bpn40Y FF9yiYAtxfmXcfPwIPBuwDYYYDHj925R7oLBCleAp4YGMMuPKBryLRmsqgQylyDzxVTK O5KrhLhfuJ4nxuAkxPCniu2ZZsHBaO3II7/uX/ml5uGUOep/+3DlelgbLFSiW+T1XBXF Vu61HxaLEDfCw3cbXpPQrQkoEYVGUH+eBTUTE5WEOw2HKdw+1gDMashkb49B8mnaMgX/ D9IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=bYROoITL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a21si4840803ejc.336.2020.12.11.10.32.17; Fri, 11 Dec 2020 10:32:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=bYROoITL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395155AbgLKQQn (ORCPT + 99 others); Fri, 11 Dec 2020 11:16:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395141AbgLKQQj (ORCPT ); Fri, 11 Dec 2020 11:16:39 -0500 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A102C0613D3 for ; Fri, 11 Dec 2020 08:15:59 -0800 (PST) Received: by mail-ej1-x641.google.com with SMTP id bo9so13059827ejb.13 for ; Fri, 11 Dec 2020 08:15:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=WW/IgNhybzf9n43eMLzqyKuFaTrBzPIKMpnR7SzERUk=; b=bYROoITLccQpGFGMZXPD6eWxSyrqAjonuDGHEXaEMRMw2U73UZPBA/Wx+3wcdLnuwE gH9Z8XDcULoJPsPcibh0AIQarFEI/KJBT0PJ6EA+bHu6T8MPr31cyPmomih/kjn5jZN7 m8npqnDCucqxPsaatevB23b9SJj+ogwBY0rjZvp69Gjpbf+e+RzXPhh5A4eel+1sspFD x7FLY4Z07Wuzs1fGnz/y/aZTwusaVyQ4LocM7f1JYm86LAB2OOTRax8ujzryu2yP2Ccz ue90Kdx0V68pf/HNNRQhRhrQ8KqbaMiZn2oaZCKv9J9va1bg1TEY7vGFP2UbEtaCXYM3 CkEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WW/IgNhybzf9n43eMLzqyKuFaTrBzPIKMpnR7SzERUk=; b=fjbKTkw/2ipnEEImXDhoV1HIWvVQHEVlAXZwUu1HRRzNazFZxRprwyir0v680HyqlK CY5mrmZMzIsk4kdRaH7zmCpcEFxaCQuIlSbmYhZIARNHuaAPsjBAxiXqPRLRII7u9+1z UDaficPpfmRlDTE5nZUk4B7683NRm+4avhSvaTvPdnPfaLp6AKzFa0P1LH0dXCR+DXjR qSoSCeUpHNoTBzXgG3g2GlkYzPCcfMPuEp0Xi3m2lc0Au/sdLBZcY20oJpdP4CCCId8d p3uUIzCKxL3KjVrzH23VJhBLflV5z54raL83jJzEI30bQpPlNwW8wxaNOPLtH4P9tsbJ YFhQ== X-Gm-Message-State: AOAM533MdRLW4LDbWvo25MXo5s5DnnXR2R7LJNmEZ0DWiaEV9K+w3uax igjbsjrARpEsc6Y5cibkI7A2sg== X-Received: by 2002:a17:906:1151:: with SMTP id i17mr11899657eja.250.1607703357882; Fri, 11 Dec 2020 08:15:57 -0800 (PST) Received: from localhost ([2620:10d:c093:400::5:ee7a]) by smtp.gmail.com with ESMTPSA id ga11sm7215778ejb.34.2020.12.11.08.15.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Dec 2020 08:15:57 -0800 (PST) Date: Fri, 11 Dec 2020 17:13:52 +0100 From: Johannes Weiner To: Pavel Begunkov Cc: Christoph Hellwig , Jens Axboe , Alexander Viro , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Matthew Wilcox Subject: Re: [PATCH 2/2] block: no-copy bvec for direct IO Message-ID: <20201211161352.GB291478@cmpxchg.org> References: <51905c4fcb222e14a1d5cb676364c1b4f177f582.1607477897.git.asml.silence@gmail.com> <20201209084005.GC21968@infradead.org> <20201211140622.GA286014@cmpxchg.org> <2404b68a-1569-ce25-c9c4-00d7e42f9e06@gmail.com> <20201211153836.GA291478@cmpxchg.org> <6507b474-6f91-f99d-1dff-d7c21462813e@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6507b474-6f91-f99d-1dff-d7c21462813e@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 11, 2020 at 03:47:23PM +0000, Pavel Begunkov wrote: > On 11/12/2020 15:38, Johannes Weiner wrote: > > On Fri, Dec 11, 2020 at 02:20:11PM +0000, Pavel Begunkov wrote: > >> On 11/12/2020 14:06, Johannes Weiner wrote: > >>> On Wed, Dec 09, 2020 at 08:40:05AM +0000, Christoph Hellwig wrote: > >>>>> + /* > >>>>> + * In practice groups of pages tend to be accessed/reclaimed/refaulted > >>>>> + * together. To not go over bvec for those who didn't set BIO_WORKINGSET > >>>>> + * approximate it by looking at the first page and inducing it to the > >>>>> + * whole bio > >>>>> + */ > >>>>> + if (unlikely(PageWorkingset(iter->bvec->bv_page))) > >>>>> + bio_set_flag(bio, BIO_WORKINGSET); > >>>> > >>>> IIRC the feedback was that we do not need to deal with BIO_WORKINGSET > >>>> at all for direct I/O. > >>> > >>> Yes, this hunk is incorrect. We must not use this flag for direct IO. > >>> It's only for paging IO, when you bring in the data at page->mapping + > >>> page->index. Otherwise you tell the pressure accounting code that you > >>> are paging in a thrashing page, when really you're just reading new > >>> data into a page frame that happens to be hot. > >>> > >>> (As per the other thread, bio_add_page() currently makes that same > >>> mistake for direct IO. I'm fixing that.) > >> > >> I have that stuff fixed, it just didn't go into the RFC. That's basically > >> removing replacing add_page() with its version without BIO_WORKINGSET > > I wrote something strange... Should have been "replacing add_page() in > those functions with a version without BIO_WORKINGSET". No worries, I understood. > >> in bio_iov_iter_get_pages() and all __bio_iov_*_{add,get}_pages() + > >> fix up ./fs/direct-io.c. Should cover all direct cases if I didn't miss > >> some. > > > > Ah, that's fantastic! Thanks for clarifying. > > To keep it clear, do we go with what I have stashed (I'm planning to > reiterate this weekend)? or you're going to write it up yourself? > Just in case there is some cooler way you have in mind :) Honestly, I only wrote all my ideas down and asked for feedback because I wasn't super excited about any of them ;-) If your changes happen to separate the direct io path from the buffered io path naturally, I'm okay with it. I'd say let's go with what you already have and see whether Jens and Christoph like it. We can always do follow-on cleanups.