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=-15.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 F1501C433DB for ; Tue, 9 Feb 2021 14:27:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DE79264E75 for ; Tue, 9 Feb 2021 14:27:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE79264E75 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 621DE6B006E; Tue, 9 Feb 2021 09:27:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D1A06B0070; Tue, 9 Feb 2021 09:27:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C0B36B0071; Tue, 9 Feb 2021 09:27:14 -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 377C56B006E for ; Tue, 9 Feb 2021 09:27:14 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id F16448248047 for ; Tue, 9 Feb 2021 14:27:13 +0000 (UTC) X-FDA: 77798956746.24.841B3F3 Received: from mail-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) by imf02.hostedemail.com (Postfix) with ESMTP id 6BB7140001FE for ; Tue, 9 Feb 2021 14:27:12 +0000 (UTC) Received: by mail-il1-f180.google.com with SMTP id q5so16219403ilc.10 for ; Tue, 09 Feb 2021 06:27:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=aq3qgdzINRFL23Dn3U54dtZVmlL/iGXyyjOyYitYchg=; b=Q8eJFyBOVIbD4ogb828BynFVMXVFH7Zvbd1xm5sf2+LB5zd+WDT3l59CLRjKS2ML6h bD+zrDDwbw7CtIv2yG6nq7s4FSgZf7uLmJ8hV98Em86K+9g7H3rVt2dm+PE3ZzCji0Kr 3yeM4T5g2cYIDBmZj3/qMSh63aBvf39S7Ol4r3LP2D0+mjuD9z1CkkPyNo4ClpiOudyp jgeS8SpP4Na0FIxSZYkD/Ejqp98EaPpoyKE+EeA+e89Zstf86PXP9FTjTahysL/Pqa/x HvETpChb95LlayAISbhSCOYU8MYV6RMqlC+t47qzG1seCouo/7zwqEcgSWjwkuVbYt3J djXA== 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=aq3qgdzINRFL23Dn3U54dtZVmlL/iGXyyjOyYitYchg=; b=RR1qbKNIEL3i8t7oolqO8BRSJ/MaIAUjVqIwkxvORHgj8UjaEeDIt1fPZPE5rf+B9r yNtuXO5x2ULCsFApSuGYEJ2dn2uN//PzDYmtwr1TkQCxUQiU3aptfAsYJf6ix2/yKTRu q0PjmzAJHZTL+fwax12u1wbWDm4gvAMtVVDlt1SwF7oJR8v3+tYHIoQOu0KgRx7KptZB Y9FXZEgCOiKQhadJRRCJaNnN71h4umfEQneJjlht+kqAaGMGZPecYQID+YqOaqXslbjg 4YE9RYkWxvbHXyE5jSSuNE2MWigaQVgBQ2jKEB1OO06eGI0bF+bkH+JkGrMHE3UHsKUz ivOA== X-Gm-Message-State: AOAM530x1Scf4CFMOOecVMCA2BJ39O7kqFGHItDqaCEbWobyV17Hhi37 duYVXvI6jFCVvtLC9eyM7b2TBA== X-Google-Smtp-Source: ABdhPJwfwCe2fYUCEX2oziQhxEYkTu1eHBrgoBCkz+EjImveMu91Rq6576Dbv4B/2c+J4VmCai8m0w== X-Received: by 2002:a92:2e05:: with SMTP id v5mr21507028ile.241.1612880832503; Tue, 09 Feb 2021 06:27:12 -0800 (PST) Received: from [192.168.1.30] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id b1sm3984200iob.42.2021.02.09.06.27.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Feb 2021 06:27:12 -0800 (PST) Subject: Re: [PATCH 2/3] mm: use filemap_range_needs_writeback() for O_DIRECT reads To: Christoph Hellwig Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org References: <20210209023008.76263-1-axboe@kernel.dk> <20210209023008.76263-3-axboe@kernel.dk> <20210209074814.GB1696555@infradead.org> From: Jens Axboe Message-ID: <07f67e83-ddfa-19f9-e4d5-f06a939b8840@kernel.dk> Date: Tue, 9 Feb 2021 07:27:11 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210209074814.GB1696555@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Stat-Signature: 3w35tmozqno1o5d9jmodcb9kzwap3d39 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 6BB7140001FE Received-SPF: none (kernel.dk>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=mail-il1-f180.google.com; client-ip=209.85.166.180 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1612880832-62779 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 2/9/21 12:48 AM, Christoph Hellwig wrote: > On Mon, Feb 08, 2021 at 07:30:07PM -0700, Jens Axboe wrote: >> For the generic page cache read helper, use the better variant of checking >> for the need to call filemap_write_and_wait_range() when doing O_DIRECT >> reads. This avoids falling back to the slow path for IOCB_NOWAIT, if there >> are no pages to wait for (or write out). >> >> Signed-off-by: Jens Axboe >> --- >> mm/filemap.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/mm/filemap.c b/mm/filemap.c >> index 6a58d50fbd31..c80acb80e8f7 100644 >> --- a/mm/filemap.c >> +++ b/mm/filemap.c >> @@ -2643,8 +2643,8 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) >> >> size = i_size_read(inode); >> if (iocb->ki_flags & IOCB_NOWAIT) { >> - if (filemap_range_has_page(mapping, iocb->ki_pos, >> - iocb->ki_pos + count - 1)) >> + if (filemap_range_needs_writeback(mapping, iocb->ki_pos, >> + iocb->ki_pos + count - 1)) > > Please avoid the overy long line, which is trivial to do by using the > normal two tab indent for the continuation. Sure, fixed. -- Jens Axboe