Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7012144imu; Thu, 31 Jan 2019 03:33:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN6EtsYMoNqUNYlT080n7vY4GMN2+6yOq7FUPqbLSphY14DkAYjDv9uogr7ZCxeZB20so8yu X-Received: by 2002:a17:902:2867:: with SMTP id e94mr34885518plb.264.1548934395852; Thu, 31 Jan 2019 03:33:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548934395; cv=none; d=google.com; s=arc-20160816; b=JSM0jHQALvM5ewkU2iopd1vmMbnG9oD+GAy6dojXKHPHGtJYGnJOHMvYDeX9vuXc0e Tf8FHrBT/6/7XOXTHAlE4+PccjN2mXDlFVhigDrbKU+9HZjvm12svfQ+5mUO1CZAGYig WGTRwBh1JWnroazcyjMWpuVaOC3+Ja0140uV5yoXnd1itfLBkADUHNE9F/7P8Qchaphb 6KZNVN5n2hrFJPF+VEOWodVgwzQxqbia39sCfnX7Per+8jcW+6yU6QFLrNyNsKoSeT/M U6UEE0SCpfoUz751/JiUL+6OYFhn2PvmFVmQRKx7Uw2lHvX8N+jKVv9Oc7WA43J2TZTO EEtg== 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=OddDy3peBL+A4RHx1CvooQ+NJa1G93UNwUWbdWsLGX0=; b=UzALSf2BsIGWP5dZAtQerQpd34Q6eYi1AvJrx6TwjCPQsreDXo31SUdH+ue0RcKren 5RroLDJXGyXCNUpM7OEUpzADAXKUL4OzOlvAJhb/F/4+NOy39KzN5O4JFu47WjX2wb3Y uyqw89FBh4kvfAkl/XjeVhdcfNbkdvi/Y68fMMtVNu1Nqs8omG661xZgKSk9VocLAXVq 5oo7UyJdsPdhr3GMRiOsYQitg6hOurXz/02aFYckg0zzoOx2QgqHPY1S6QSYbr3Q2ZDq SaT0gXoFdp/r/b1y7w70gOurEdXbzzMZdZ5VQri2RLPkL/qkwEI5Y2nvUVVKj48VBt2V tDkw== 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 b2si3991655pgh.475.2019.01.31.03.33.00; Thu, 31 Jan 2019 03:33:15 -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 S1732403AbfAaLca (ORCPT + 99 others); Thu, 31 Jan 2019 06:32:30 -0500 Received: from mx2.suse.de ([195.135.220.15]:34978 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728108AbfAaLca (ORCPT ); Thu, 31 Jan 2019 06:32:30 -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 6F021B0B9; Thu, 31 Jan 2019 11:32:28 +0000 (UTC) Date: Thu, 31 Jan 2019 12:32:23 +0100 From: Michal Hocko To: Jiri Kosina 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 , 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: <20190131113223.GU18811@dhcp22.suse.cz> References: <20190130124420.1834-1-vbabka@suse.cz> <20190130124420.1834-3-vbabka@suse.cz> <20190131095644.GR18811@dhcp22.suse.cz> <20190131102348.GT18811@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Thu 31-01-19 11:30:24, Jiri Kosina wrote: > On Thu, 31 Jan 2019, Michal Hocko wrote: > > > > > > 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? > > > > > > page_cache_sync_readahead() only submits the read ahead request(s), it > > > doesn't wait for it to finish. > > > > OK, I guess my question was not precise. What does prevent taking fs > > locks down the path? > > Well, RWF_NOWAIT doesn't mean the kernel can't reschedule while executing > preadv2(), right? It just means it will not wait for the arrival of the > whole data blob into pagecache in case it's not there. No, it can reschedule for sure but the man page says: : If this flag is specified, the preadv2() system call will return : instantly if it would have to read data from the backing storage or wait : for a lock. I assume that the lock is meant to be a filesystem lock here. -- Michal Hocko SUSE Labs