Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6927069imu; Thu, 31 Jan 2019 01:57:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN7fakyUjZYuH1mkoloZMlLgcYpfzaLLeloyuokCknV2yA1FKtX6u3eB6V7q+X/CAcxbxB96 X-Received: by 2002:a63:d40a:: with SMTP id a10mr30400822pgh.394.1548928637951; Thu, 31 Jan 2019 01:57:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548928637; cv=none; d=google.com; s=arc-20160816; b=Q2TcOT0iMaqXeqb7/93ig5wnZZpB4S0u3z3IrvVziZX6YV2c/S/pysE325JW4feCE7 n11VxYv4dTao70DFQxt4VsnkjNgM9ybBIm/iTfHGGVb5hJf6LtrNSvcN6+30CvjPcGGN 6bh7oiB0FnGBg9zJkJvftyLwUP8aqazwBcJXiQRTJ/IBQW4aNtmRDbwjZBQoEjIaKxh6 KhHEpcJ+YKJYq+MrRXBhUsOfq8YkiKPj6eCf10l/B/ND/zGSaQxKQCpoJX/JaF0z7XJr YkT/d6vbnp2VJzX0gyG5u62jrLMZYKc3nzWo5R5hvqXpELzEOcUjey01wQwufjzT8XJJ elDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Qo2xxeek5vA+c1FFjuJ/H4icDx/FEzYp0Mj/oj/MdFQ=; b=DqJWd2gsdNcbIfXnBb8lw5gm/dMVMOsaHAe4+8fsfpgoUQCINu1Su2UQdbbPFL/dDD 7q5Akt3JmZCuAelEItindy7uCmq5c4dU/PApIu85ZB5GHxqWubF8PKUI373IZEVaqnqP 1Vw/pWZfNkTk4dqD1ZxkUOOrSTJiO4/pMulvRKRzh7rHkQ2+XI+HdaIUWUnXrSGH/G4J lGhfuZwKjiAb0921BfLGl/qp/pjJu5Jvpz2vbFISqxF4YHrk5NGigcdkmwwfHszTCohk 9T14wCINpJBzCpv6KbgY/qNMIZxIBSjgolxG4sN+Kx589VIZ8bHXP6SGzowQgFOFX9Z+ w/Ng== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 u27si4136552pfa.103.2019.01.31.01.57.02; Thu, 31 Jan 2019 01:57: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731868AbfAaJ4r (ORCPT + 99 others); Thu, 31 Jan 2019 04:56:47 -0500 Received: from mx2.suse.de ([195.135.220.15]:45660 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726316AbfAaJ4r (ORCPT ); Thu, 31 Jan 2019 04:56:47 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 603D8AD3C; Thu, 31 Jan 2019 09:56:45 +0000 (UTC) Date: Thu, 31 Jan 2019 10:56:44 +0100 From: Michal Hocko To: Vlastimil Babka Cc: Andrew Morton , Linus Torvalds , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, Peter Zijlstra , Greg KH , Jann Horn , Jiri Kosina , Dominique Martinet , Andy Lutomirski , Dave Chinner , Kevin Easton , Matthew Wilcox , Cyril Hrubis , Tejun Heo , "Kirill A . Shutemov" , Daniel Gruss , Jiri Kosina , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 2/3] mm/filemap: initiate readahead even if IOCB_NOWAIT is set for the I/O Message-ID: <20190131095644.GR18811@dhcp22.suse.cz> References: <20190130124420.1834-1-vbabka@suse.cz> <20190130124420.1834-3-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190130124420.1834-3-vbabka@suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Cc fs-devel] On Wed 30-01-19 13:44:19, Vlastimil Babka wrote: > From: Jiri Kosina > > preadv2(RWF_NOWAIT) can be used to open a side-channel to pagecache contents, as > it reveals metadata about residency of pages in pagecache. > > If preadv2(RWF_NOWAIT) returns immediately, it provides a clear "page not > resident" information, and vice versa. > > Close that sidechannel by always initiating readahead on the cache if we > encounter a cache miss for preadv2(RWF_NOWAIT); with that in place, probing > the pagecache residency itself will actually populate the cache, making the > sidechannel useless. I guess the current wording doesn't disallow background IO to be triggered for EAGAIN case. I am not sure whether that breaks clever applications which try to perform larger IO for those cases though. > Originally-by: Linus Torvalds > Cc: Dominique Martinet > Cc: Andy Lutomirski > Cc: Dave Chinner > Cc: Kevin Easton > Cc: Matthew Wilcox > Cc: Cyril Hrubis > Cc: Tejun Heo > Cc: Kirill A. Shutemov > Cc: Daniel Gruss > Signed-off-by: Jiri Kosina > Signed-off-by: Vlastimil Babka > --- > mm/filemap.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/mm/filemap.c b/mm/filemap.c > index 9f5e323e883e..7bcdd36e629d 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -2075,8 +2075,6 @@ static ssize_t generic_file_buffered_read(struct kiocb *iocb, > > page = find_get_page(mapping, index); > if (!page) { > - if (iocb->ki_flags & IOCB_NOWAIT) > - goto would_block; > page_cache_sync_readahead(mapping, > ra, filp, > index, last_index - index); Maybe a stupid question but I am not really familiar with this path but what exactly does prevent a sync read down page_cache_sync_readahead path? -- Michal Hocko SUSE Labs