From patchwork Wed Feb 12 22:16:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minchan Kim X-Patchwork-Id: 11379237 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A8FB921 for ; Wed, 12 Feb 2020 22:16:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D1B1C21734 for ; Wed, 12 Feb 2020 22:16:24 +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="m2+iclFG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1B1C21734 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 E3B2D6B049A; Wed, 12 Feb 2020 17:16:23 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DEBC56B049B; Wed, 12 Feb 2020 17:16:23 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D01946B049C; Wed, 12 Feb 2020 17:16:23 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id B69376B049A for ; Wed, 12 Feb 2020 17:16:23 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 55F6E181AC9CC for ; Wed, 12 Feb 2020 22:16:23 +0000 (UTC) X-FDA: 76482884646.20.grade58_71f052435e926 X-Spam-Summary: 2,0,0,18a0cf002bfd1477,d41d8cd98f00b204,minchan.kim@gmail.com,:akpm@linux-foundation.org::linux-kernel@vger.kernel.org:jack@suse.cz:willy@infradead.org:josef@toxicpanda.com:hannes@cmpxchg.org:minchan@kernel.org:snazy@gmx.de,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1437:1515:1534:1541:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3871:3874:4250:4321:5007:6261:6653:7576:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:12986:13069:13161:13221:13229:13311:13357:13894:14096:14181:14384:14394:14721:21080:21444:21451:21627:21966:21990:30054:30090,0,RBL:209.85.210.195:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: grade58_71f052435e926 X-Filterd-Recvd-Size: 4382 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Wed, 12 Feb 2020 22:16:22 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id i6so1934619pfc.1 for ; Wed, 12 Feb 2020 14:16:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IRbfdGWqcwmnNp2DnvQOXpGpDdlJdzZpC1N7ZpXf7R4=; b=m2+iclFGS8CzBhvrLeUiObRXq+BHsUSMMB7Vj20hZbpVGnjh/++VyGUTYt2woRJvbz L/tFb9D7IjjcHYxbU1p16n0jDAd49fMG5fydr961+y1BEXCfEkYgb+tn1HlwvBfA7Bk6 I9/cVK87OWQEVxTu8l4ZyYDMQ3fRJlGRnfAe3+Uf2t0Ncu/tzwbO7i0xk8enb/Cjcv1w YZOPvQVFwN9Joc3PLsZNieDH1S0lhbebYGRgZGijwZTApsCTAiSfFZDmWBpfV/IwAcQj AFrnPWicOYux0+P25+pC2SJAJIkuHnqMOCaXq8aQ1oa0O+S29vcTAOFJYlxuEeemPoyc /RsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=IRbfdGWqcwmnNp2DnvQOXpGpDdlJdzZpC1N7ZpXf7R4=; b=UCJQaMGeD55Pcr6OFoFwW6JiMq91leTnf5nSUvZMu6L/rQszwStrsCQIgnAxac+DvE HldvRzqm9307yaz0R/2EA2fqr5gHl11xW6kWZbvLSmyWgEzT5fJ++vi9gYyuMBTQGOlB 2FbgnGZ2otWkS+mVypQgxRPi+0e47/EJPlGsREqwDNBevg4zfCzf7uz+jC2wf/6dx11x PBR9BuswFw/OLWblTeiRU6P5sVyHDLuCzjxjn3Dtax51yXjZRkY6n1k2qs0lNZa1hCRQ XtxTYA7w6RXkBptbiCItDTH1KIHXzg7Xkmu+0JHZYbnnr4kdkwHGSONfw/4gOJpjWhq4 qe1w== X-Gm-Message-State: APjAAAXhPPmRXPpKm+uHfkxrMIRs02KuKsd2jkrkE8KV/VAyG0+6hUAv AudBDr64kQL/LSzmxZnFN8s= X-Google-Smtp-Source: APXvYqzIIedGxf8nZB9JoeCmITqMhnSUr9gnQJ8hlq9gR2gywKw1M3NDG//Z/TKJd6Spy2jGjOp+xw== X-Received: by 2002:aa7:9808:: with SMTP id e8mr14135402pfl.32.1581545781691; Wed, 12 Feb 2020 14:16:21 -0800 (PST) Received: from bbox-1.mtv.corp.google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id o10sm117683pgq.68.2020.02.12.14.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 14:16:20 -0800 (PST) From: Minchan Kim To: Andrew Morton Cc: linux-mm , LKML , Jan Kara , Matthew Wilcox , Josef Bacik , Johannes Weiner , Minchan Kim , Robert Stupp Subject: [PATCH 1/3] mm: Don't bother dropping mmap_sem for zero size readahead Date: Wed, 12 Feb 2020 14:16:12 -0800 Message-Id: <20200212221614.215302-1-minchan@kernel.org> X-Mailer: git-send-email 2.25.0.225.g125e21ebc7-goog MIME-Version: 1.0 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: From: Jan Kara When handling a page fault, we drop mmap_sem to start async readahead so that we don't block on IO submission with mmap_sem held. However there's no point to drop mmap_sem in case readahead is disabled. Handle that case to avoid pointless dropping of mmap_sem and retrying the fault. This was actually reported to block mlockall(MCL_CURRENT) indefinitely. Fixes: 6b4c9f446981 ("filemap: drop the mmap_sem for all blocking operations") Reported-by: Minchan Kim Reported-by: Robert Stupp Reviewed-by: Minchan Kim Reviewed-by: Josef Bacik Signed-off-by: Jan Kara Signed-off-by: Minchan Kim --- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index 1784478270e1..5bffaa2176cd 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2416,7 +2416,7 @@ static struct file *do_async_mmap_readahead(struct vm_fault *vmf, pgoff_t offset = vmf->pgoff; /* If we don't want any read-ahead, don't bother */ - if (vmf->vma->vm_flags & VM_RAND_READ) + if (vmf->vma->vm_flags & VM_RAND_READ || !ra->ra_pages) return fpin; if (ra->mmap_miss > 0) ra->mmap_miss--;