Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp926287imu; Tue, 11 Dec 2018 09:39:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/UGe9UOUVOXKYw91bJfVDI1wqc4CegL+md58J2nogkPvKQCDF5A9UgzDEXbLUB5nAM/pms/ X-Received: by 2002:a17:902:b78b:: with SMTP id e11mr16963582pls.90.1544549974524; Tue, 11 Dec 2018 09:39:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544549974; cv=none; d=google.com; s=arc-20160816; b=Y5w5pQXmuWpoRFPiWIOr9PVsAE9fxljeioOvoGacQ7+w7j0bqPlkRBgPPksruu0+G7 0y0KvAuleA8c5NkNkzCP0d0kwR3B2fLOu2faPSW9wtQyIgfrEORVTe6DBOQJhHhnhT0b bLWzBkhHDARW50xxkP3bcxoDuNoxP9nBSfLv/9B6fVzWoTvmW6Tl7Xlo7twVEp9JPu8q sPQ7pKXlYwhy/ZPzWwTKR0XmFcY4cLErm9jV7LDcsfIVJ811TvHLNZp+qAfdS9+ZeAM6 SJdIv2Q6E5qCDtXFIjnB0Jz3RE+hPHEqgjRzmZrOeitOSc73odU0HBxlcPOzt3x2XiVk G49g== 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=sVAAx1GvEVlPL2MvMDn/e+RCHYGGHINiqBTlqLI//vY=; b=XM2Xbu/jLweT62Lct3XXx2ukdbRkvfdaBqX+JYRqrGWEXRiSM2LmjVofM1i/aUzOMI xbV867vTyr3EuRA7z+VM3cOOVFFXgvk8DYszKObE4xK7WhQx1P9ldwlMz0TZ4ggqz4v7 qWy/NlvH6Y5rfRQS7vXaGMJbbvMf7BzW2FpnwoXLixfYScpsxAfzIvcwT5BkuV5eyjY5 GZHzNN2CVvp5oRQAnuCQJ0YBzJJw6IHfAyx0s7UvizzAgs1GvNk1DKkBRGHKg+0Bjmcx tFEO3podyeI69wJ+w0iJmlF8EjrOnvBlQf7fAa2sZlgEmX3iRI9NlZnAgYxb6f+gRblV belg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12si12707800pgf.22.2018.12.11.09.39.19; Tue, 11 Dec 2018 09:39:34 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727648AbeLKQiU (ORCPT + 99 others); Tue, 11 Dec 2018 11:38:20 -0500 Received: from mx2.suse.de ([195.135.220.15]:46200 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726723AbeLKQiT (ORCPT ); Tue, 11 Dec 2018 11:38:19 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D7829AF89; Tue, 11 Dec 2018 16:38:17 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 0AD291E13F8; Tue, 11 Dec 2018 17:38:17 +0100 (CET) Date: Tue, 11 Dec 2018 17:38:17 +0100 From: Jan Kara To: Josef Bacik Cc: Jan Kara , kernel-team@fb.com, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, tj@kernel.org, david@fromorbit.com, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, riel@redhat.com Subject: Re: [PATCH 3/4] filemap: drop the mmap_sem for all blocking operations Message-ID: <20181211163817.GA4020@quack2.suse.cz> References: <20181130195812.19536-1-josef@toxicpanda.com> <20181130195812.19536-4-josef@toxicpanda.com> <20181207110138.GE13008@quack2.suse.cz> <20181210184438.va7mdwjgwndgri4s@macbook-pro-91.dhcp.thefacebook.com> <20181211094034.GD17539@quack2.suse.cz> <20181211160851.hqezlvlded6zujrm@macbook-pro-91.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181211160851.hqezlvlded6zujrm@macbook-pro-91.dhcp.thefacebook.com> 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 Tue 11-12-18 11:08:53, Josef Bacik wrote: > On Tue, Dec 11, 2018 at 10:40:34AM +0100, Jan Kara wrote: > > > The lock_page_or_retry() case in particular gets hit a lot with > > > multi-threaded applications that got paged out because of heavy memory > > > pressure. By no means is it as high as just the normal readpage or > > > readahead cases, but it's not 0, so I'd rather have the extra helper here > > > to make sure we're never getting screwed. > > > > Do you mean the case where we the page is locked in filemap_fault() (so > > that lock_page_or_retry() bails after waiting) and when the page becomes > > unlocked it is not uptodate? Because that is the reason why you opencode > > lock_page_or_retry(), right? I'm not aware of any normal code path that > > would create page in page cache and not try to fill it with data before > > unlocking it so that's why I'm really trying to make sure we understand > > each other. > > Uhh so that's embarressing. We have an internal patchset that I thought > was upstream but hasn't come along yet. Basically before this patchset > the way we dealt with this problem was to short-circuit readahead IO's by > checking to see if the blkcg was congested (or if there was a fatal > signal pending) and doing bio_wouldblock_error on the bio. So this very > case came up a lot, readahead would go through because it got in before > we were congested, but would then get throttled, and then once the > throttling was over would get aborted. Other threads would run into > these pages that had been locked, but they are never read in which means > they waited for the lock to be dropped, did the VM_FAULT_RETRY, came back > unable to drop the mmap_sem and did the actual readpage() and would get > throttled. OK, I'm somewhat unsure why we throttle on bios that actually get aborted but that's a separate discussion over a different patches. Overall it makes sense that some submitted readahead may actually get aborted on congestion and thus unlocked pages will not be uptodate. So I agree that this case is actually reasonably likely to happen. Just please mention case like aborted readahead in the comment so that we don't wonder about the reason in a few years again. Honza -- Jan Kara SUSE Labs, CR