Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7014155imu; Thu, 31 Jan 2019 03:35:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN7lFdtPogcs1dPpFGRzdqRh84kRDkFO4Pnbw0nV5qGF9Rp3OGK6s3SV1DZXCzH7u+Z3WT4u X-Received: by 2002:a17:902:2bc5:: with SMTP id l63mr34992242plb.107.1548934517316; Thu, 31 Jan 2019 03:35:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548934517; cv=none; d=google.com; s=arc-20160816; b=w5v6wVmP3MU1/3Duq/IVRRyZ8E7q13w2rrolS36n3HO+6eg9laYXB/TXrIdLuC1pfv 0eyNzQf/MXbe0/F+3Pp8LyrXo5QFf2OzKH5bBGGlYObKRYGuAwS8Y9UaHRuunEh0s1xy aR8KaukioKkN+yMuDgvac+xCOePIOlR05u62Rc+6ROlz1IA0DEaKqxje7jnpolLjPMhE mO36A64RlWeBMxsRknss4K1nfZYT4+KiOIKgbVYd9LRUawAtzmSy6tiMfgeXN2E9yksg X6ZI/eMWWBTTlmDf0LhA4kY0IsEEJqZENNji8cTrDLFxyGAGiEPjV484S1Jspx0Q6lLg 5xUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=tG7iZlGAHpTabFEMX3yuBH7oDEDoZZ3WfHqqGxaohM4=; b=IToShdh5z2tuxm+c79VB9YUiP6ksECw/DHHlEL5G7XJFKAnqHBSiwqq2hEByZwW8oB cIITArLmJZyTC5prZWlcRIwUJ4gwaakFIyVW8frlY+QSDomSu+AucziXLXjPfK2LpuXk pSaq0ht4SZYpFPgMV0PlzjgYBpbNaqc6ncHqurvzFtuY3Of9UDavsy/SCHptJT6WEGA6 pyb6+Z9+5l5m3j05Y1opz5iD4Sj8iNlEAFkSyhkIcCrUYu/cLvpdOPf3xHTRQvy+EDws 8kTZixCTJncUnpiW4Er/CLthTvEIQmXMepMvQfOrRf+Uy0qVB2Klh1C/HC1Yk15whcJb G9Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AhA68lec; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 102si4367259plc.277.2019.01.31.03.35.01; Thu, 31 Jan 2019 03:35:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AhA68lec; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732343AbfAaLeu (ORCPT + 99 others); Thu, 31 Jan 2019 06:34:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:50366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726221AbfAaLet (ORCPT ); Thu, 31 Jan 2019 06:34:49 -0500 Received: from pobox.suse.cz (prg-ext-pat.suse.com [213.151.95.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1859C218AF; Thu, 31 Jan 2019 11:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548934489; bh=SFVfJoJ5TREELE0WD6PH6m5/w/yW7Aknfnn9AUYvQP0=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=AhA68lecaRUyoHyE8td5xQh/w2blB1dTK5V42cd/a1IxY1uNaZMgLj0HIlwxbFjM+ yxCss+2pzG5OI/nbVrL5M2v1rtvk3vJ/Af+jBtXP7g/zo3vwo9/ivJ3l2OqkROiAHA NLGcJFt00TOEsgplHJ4wFQmV2eQ8amQeX/+1Fpo0= Date: Thu, 31 Jan 2019 12:34:44 +0100 (CET) From: Jiri Kosina To: Florian Weimer cc: Vlastimil Babka , Andrew Morton , Linus Torvalds , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, Peter Zijlstra , Greg KH , Jann Horn , Dominique Martinet , Andy Lutomirski , Dave Chinner , Kevin Easton , Matthew Wilcox , Cyril Hrubis , Tejun Heo , "Kirill A . Shutemov" , Daniel Gruss Subject: Re: [PATCH 2/3] mm/filemap: initiate readahead even if IOCB_NOWAIT is set for the I/O In-Reply-To: <87imy5f6ir.fsf@oldenburg2.str.redhat.com> Message-ID: References: <20190130124420.1834-1-vbabka@suse.cz> <20190130124420.1834-3-vbabka@suse.cz> <87munii3uj.fsf@oldenburg2.str.redhat.com> <87imy5f6ir.fsf@oldenburg2.str.redhat.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 31 Jan 2019, Florian Weimer wrote: > >> I think this needs to use a different flag because the semantics are so > >> much different. If I understand this change correctly, previously, > >> RWF_NOWAIT essentially avoided any I/O, and now it does not. > > > > It still avoid synchronous I/O, due to this code still being in place: > > > > if (!PageUptodate(page)) { > > if (iocb->ki_flags & IOCB_NOWAIT) { > > put_page(page); > > goto would_block; > > } > > > > but goes the would_block path only after initiating asynchronous > > readahead. > > But it wouldn't schedule asynchronous readahead before? It would, that's kind of the whole point. > I'm worried that something, say PostgreSQL doing a sequential scan, > would implement a two-pass approach, first using RWF_NOWAIT to process > what's in the kernel page cache, and then read the rest without it. If > RWF_NOWAIT is treated as a prefetch hint, there could be much more read > activity, and a lot of it would be pointless because the data might have > to be evicted before userspace can use it. So are you aware of anything already existing, that'd implement this semantics? I've quickly grepped https://github.com/postgres/postgres for RWF_NOWAIT, and they don't seem to use it at all. RWF_NOWAIT is rather new. The usecase I am aware of is to make sure that the thread doing io_submit() doesn't get blocked for too long, because it has other things to do quickly in order to avoid starving other sub-threads (and delegate the I/O submission to asynchronous context). -- Jiri Kosina SUSE Labs