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=-5.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 8C360C433E7 for ; Sat, 17 Oct 2020 19:36:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 83627207FF for ; Sat, 17 Oct 2020 19:36:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="mOdfg1YO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83627207FF 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 AEB526B005D; Sat, 17 Oct 2020 15:36:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A73E46B0068; Sat, 17 Oct 2020 15:36:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8ED276B006E; Sat, 17 Oct 2020 15:36:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0076.hostedemail.com [216.40.44.76]) by kanga.kvack.org (Postfix) with ESMTP id 5F86E6B005D for ; Sat, 17 Oct 2020 15:36:52 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id F07911EE6 for ; Sat, 17 Oct 2020 19:36:51 +0000 (UTC) X-FDA: 77382425022.11.use69_190d13927228 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id D0C7C180F8B81 for ; Sat, 17 Oct 2020 19:36:51 +0000 (UTC) X-HE-Tag: use69_190d13927228 X-Filterd-Recvd-Size: 4886 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Sat, 17 Oct 2020 19:36:51 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id w11so2964977pll.8 for ; Sat, 17 Oct 2020 12:36:51 -0700 (PDT) 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=r9OIUHxDhlmhWxQMT90Jdl3e9ou25F3nAkNEI6bVHrQ=; b=mOdfg1YOpUne6/Us0RYQRqZLqDe49Hf2yEIysyU5J1BpLANRHv06o3iy5IQ7sNU/xu 4TevFvJ8Bt8sGz7a9zLVQ7kL+2/mWkM8y3DXbpSpbIC1VjiVwNQa0UYtw7drNhbi4hlq VLwV2RDkzzQuXoqwaYu+K/Z54ncduVaoZZnqp8nBgNksExpDRv2q6IUR4eOpszK/7hVb LlfDk+ePX2X+wz/xl0137WX7VHd3IwJfi7+Q1Ko/mHbDtLbml41TlnaxhFqMkz4bBJm1 F7lGrThyugsaie+4dTUvZ4Jo/1rob1KLJg0a7iZgEq/+Xu6UcwDncHn8ucqeCjEHercu l4vg== 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=r9OIUHxDhlmhWxQMT90Jdl3e9ou25F3nAkNEI6bVHrQ=; b=EscyIMaQcnJXkztG0mowPReX27ZERA2F/jDw0/GdS//6pnzu/pIFwpuoatdU7tZpv2 GHfyEdIWYfTO8OE6Y71Tc0pltK2DFQmA220ZzsxDwG0sBmdaC1xO6F+8AH5nE7vBs/ST 9pnUXzdcWZ3mTCD5l3mc5d3YI3CJ3vQiAPk1Gy7KzfutFKUBdOmW+bSDSQRViQrBj5Ha cEjzTb9obnAIyNvHfKowmvHxK9aK6q9jArtNXAltYX/Otq2H8JX7bMxeGEXums2LyoF9 ExuuajGIg0QQaWVaw+RPFl39e/vejH7i1NZ3p0aWj55vo+Nkk3q0SKAyRY4+AhjnB6k6 1BkQ== X-Gm-Message-State: AOAM531N7zJc4rxJXIa0ClSwYZGG7QrIO3ewDWbJay6BFk6ABwSm1dis Ywa5HJB70RP4ISHRWX5IKXcg9Q== X-Google-Smtp-Source: ABdhPJyj+yhUVftZquvjdjQ2effDd5xZIKEdtAJmByQ+4YMyvPVSqLMWFEwzoY/exkQRigqrkXS3UQ== X-Received: by 2002:a17:90a:fa86:: with SMTP id cu6mr9897211pjb.167.1602963410130; Sat, 17 Oct 2020 12:36:50 -0700 (PDT) Received: from [192.168.1.134] ([66.219.217.173]) by smtp.gmail.com with ESMTPSA id 16sm6753443pjl.27.2020.10.17.12.36.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 17 Oct 2020 12:36:49 -0700 (PDT) Subject: Re: [PATCH] mm: mark async iocb read as NOWAIT once some data has been, copied To: Kent Overstreet Cc: Matthew Wilcox , linux-mm , Andrew Morton , Johannes Weiner References: <59eae433-9b30-f094-534d-eb5cf0a40a80@kernel.dk> <20201017162820.GI20115@casper.infradead.org> <20201017191320.GA2198928@zaphod.evilpiepirate.org> From: Jens Axboe Message-ID: Date: Sat, 17 Oct 2020 13:36:48 -0600 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: <20201017191320.GA2198928@zaphod.evilpiepirate.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 10/17/20 1:13 PM, Kent Overstreet wrote: > On Sat, Oct 17, 2020 at 11:30:47AM -0600, Jens Axboe wrote: >> On 10/17/20 10:28 AM, Matthew Wilcox wrote: >>> On Sat, Oct 17, 2020 at 09:30:59AM -0600, Jens Axboe wrote: >>>> Once we've copied some data for an iocb that is marked with IOCB_WAITQ, >>>> we should no longer attempt to async lock a new page. Instead make sure >>>> we return the copied amount, and let the caller retry, instead of >>>> returning -EIOCBQUEUED for a new page. >>>> >>>> This should only be possible with read-ahead disabled on the below >>>> device, and multiple threads racing on the same file. Haven't been able >>>> to reproduce on anything else. >>> >>> Wouldn't this do the job just as well? >>> >>> @@ -2211,6 +2211,8 @@ ssize_t generic_file_buffered_read(struct kiocb *iocb, >>> >>> put_page(page); >>> written += ret; >>> + if (iocb->ki_flags & IOCB_WAITQ) >>> + iocb->ki_flags |= IOCB_NOWAIT; >>> if (!iov_iter_count(iter)) >>> goto out; >>> if (ret < nr) { >> >> Indeed, that's cleaner. Let me re-test with that just to be on the safe >> side, and I'll post a new one. > > generic_file_buffered_read() has written passed in, which can be nonzero (DIO > fallback) - we probably want the check to be at the top of the loop. Yeah good point. That calling convention is... miserable. I'll move it up top. -- Jens Axboe