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=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, FSL_HELO_FAKE,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 BC441C352A4 for ; Wed, 12 Feb 2020 17:43:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8450A21569 for ; Wed, 12 Feb 2020 17:43:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OVshkgAz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8450A21569 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 016736B0474; Wed, 12 Feb 2020 12:43:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F08716B0475; Wed, 12 Feb 2020 12:43:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD0556B0476; Wed, 12 Feb 2020 12:43:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0093.hostedemail.com [216.40.44.93]) by kanga.kvack.org (Postfix) with ESMTP id C19FC6B0474 for ; Wed, 12 Feb 2020 12:43:33 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 922C7180AD811 for ; Wed, 12 Feb 2020 17:43:33 +0000 (UTC) X-FDA: 76482197106.24.feast59_3c173fa893614 X-HE-Tag: feast59_3c173fa893614 X-Filterd-Recvd-Size: 4809 Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Wed, 12 Feb 2020 17:43:32 +0000 (UTC) Received: by mail-pj1-f68.google.com with SMTP id fa20so1180833pjb.1 for ; Wed, 12 Feb 2020 09:43:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=rNICHkLbJTVgEdPQbhs6w63GjR1LcJl8un8NvPek2fI=; b=OVshkgAzjxdXM1zg6t1n401th/FuOWTu2lrRPuKw7zBNq000hv/19b+VfT4Ijn60l8 x0BmHMooDj9t44s0XHjLm+lLLkME57AsQZd2Iv2XLekvOwivDnToEZ240V45ZBcaM6cw VVdfiy7EhgUQdisQ5dVIaac+GvpEHaelLz7YbCNlA6z7En89ZN0NYH5TkDngk3CTtRln nt7ak0675ltINM0z5A61TSI/GsDpKvu9xCwepvQMW1WUWXXHsNaljgJYvllmXDnfHaGK k07oNGnNfP6XVI/LcJ/H3Va9Qde+YsWoyiAC4xxDsVuDDxPfA/wEcxblpNFJ2ff0CYTG 59QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=rNICHkLbJTVgEdPQbhs6w63GjR1LcJl8un8NvPek2fI=; b=JlVuinaUTKcM1ZlVp0MyJKQBIbsosZ2UkdkpOFCIMlkgxFKLg5n0AIrhqjDgSMgt5b 3CNjYwTF1QP8B7jNaXzTBmsB99whUWje1u77RqShFP2x19+ThOKZArPzzaEz7rpt2tDN b2/HQt9DOGPeVE3LTEmVTTYjVhxwMo5DFtzhUwXA4gsqS+PEjU/gVMpa7Ctj6UHwe0Xo qcrQDSzIZGv9YPntSXk7tOVO3gxtV+MZ/949jxTzloUL9eLdOASPMWsCXe1CPannJRGd TRxCBBFeH07LddDT+E6dRRtwCunGPUG+oHIBOL2miWIrbGSjDHk/9lGjwTlQUPJir+dp ihDA== X-Gm-Message-State: APjAAAW3xgOliqnDsumIbbail91Lv4FVSl8lZCknuh2jOb8PCipLGzXW yqILB61zEp/O3qaxq8U43oM= X-Google-Smtp-Source: APXvYqw55+IBnNdt1HhMxFj8Fw4EwFQH1L36LfiCFQ8NJGFpvntKixLHCo6b2U1/LOX7dlqTTn7MUg== X-Received: by 2002:a17:902:7484:: with SMTP id h4mr9112516pll.206.1581529410937; Wed, 12 Feb 2020 09:43:30 -0800 (PST) Received: from google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id l18sm1594393pfe.96.2020.02.12.09.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 09:43:29 -0800 (PST) Date: Wed, 12 Feb 2020 09:43:28 -0800 From: Minchan Kim To: Jan Kara Cc: Andrew Morton , linux-mm , Josef Bacik , Johannes Weiner , LKML Subject: Re: [PATCH] mm: fix long time stall from mm_populate Message-ID: <20200212174328.GC93795@google.com> References: <20200211001958.170261-1-minchan@kernel.org> <20200212102206.GE25573@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200212102206.GE25573@quack2.suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Wed, Feb 12, 2020 at 11:22:06AM +0100, Jan Kara wrote: > On Mon 10-02-20 16:19:58, Minchan Kim wrote: > > Basically, fault handler releases mmap_sem before requesting readahead > > and then it is supposed to retry lookup the page from page cache with > > FAULT_FLAG_TRIED so that it avoids the live lock of infinite retry. > > > > However, what happens if the fault handler find a page from page > > cache and the page has readahead marker but are waiting under > > writeback? Plus one more condition, it happens under mm_populate > > which repeats faulting unless it encounters error. So let's assemble > > conditions below. > > > > __mm_populate > > for (...) > > get_user_pages(faluty_address) > > handle_mm_fault > > filemap_fault > > find a page form page(PG_uptodate|PG_readahead|PG_writeback) > > it will return VM_FAULT_RETRY > > continue with faulty_address > > > > IOW, it will repeat fault retry logic until the page will be written > > back in the long run. It makes big spike latency of several seconds. > > > > This patch solves the issue by turning off fault retry logic in second > > trial. > > > > Signed-off-by: Minchan Kim > > --- > > It was orignated from code review once I have seen several user reports > > but didn't confirm yet it's the root cause. > > Yes, I think the immediate problem is actually elsewhere but I agree that > __mm_populate() should follow the general protocol of retrying only once > so your change should make it more robust. The patch looks good to me, you > can add: > > Reviewed-by: Jan Kara Thanks for the review!