From patchwork Tue Jun 30 00:12:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 11632917 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 9D347739 for ; Tue, 30 Jun 2020 00:12:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6A46220781 for ; Tue, 30 Jun 2020 00:12:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GFm7AzGE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A46220781 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 700858D0021; Mon, 29 Jun 2020 20:12:39 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6AF328D001D; Mon, 29 Jun 2020 20:12:39 -0400 (EDT) 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 5C7818D0021; Mon, 29 Jun 2020 20:12:39 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id 436B08D001D for ; Mon, 29 Jun 2020 20:12:39 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9CCDF180AD807 for ; Tue, 30 Jun 2020 00:12:38 +0000 (UTC) X-FDA: 76983951996.09.chess64_4d04cf726e73 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 7F392180AD806 for ; Tue, 30 Jun 2020 00:12:38 +0000 (UTC) X-Spam-Summary: 1,0,0,1f2cb4ea19be05f3,d41d8cd98f00b204,kent.overstreet@gmail.com,,RULES_HIT:41:355:379:800:960:973:988:989:1260:1277:1312:1313:1314:1345:1359:1381:1437:1516:1518:1519:1534:1541:1593:1594:1595:1596:1711:1730:1747:1777:1792:2194:2198:2199:2200:2393:2559:2562:2731:3138:3139:3140:3141:3142:3352:3867:4321:5007:6119:6261:6642:6653:7514:7875:7903:9036:9040:9413:9545:10004:10400:11026:11658:11914:12043:12048:12114:12296:12297:12438:12517:12519:12555:12895:13069:13215:13229:13255:13311:13357:13439:13895:14181:14687:14721:21080:21324:21444:21451:21627:21666:30054,0,RBL:209.85.160.194:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04yfyan48jro86d6s5ikphu7wedo6yca43ujp1jgongtz7ufyhii3udi3twmk7d.wphy4e4bwi5qpmwxh1gwgne4sbeetfwqoij84iw9usjcfz7sd1xyqwnp3sq7bxd.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: chess64_4d04cf726e73 X-Filterd-Recvd-Size: 4125 Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Tue, 30 Jun 2020 00:12:38 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id i3so14292298qtq.13 for ; Mon, 29 Jun 2020 17:12:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=a69CpnZLhKaGE1y0QOjVkguQ4McgCYqiRLiuKO0SAy8=; b=GFm7AzGEPZ4Jj7QmMtUX1wX/lPCFF3ui8xB2R2I+qzidRQDyha1w55qUaLedEfCFAn Gtxk5h8Nyi2PzXPXiAL57oPvlnPUpL1Uwka4+MMObk4LHbzbAd8tI5Dab5+LDttpOcMa nQ3xL3GZ5hr1ycGewInPXZ+V4JEc6k2su+yu8nOBkBEffSSNYYVY5d8RnI/81arZ5Sd1 jD1vlzwMaH1tIT8cCPJAjzSKgVmNRFbSOBwX2OkNIUU2XLBc+1ugrkK+8HQxwvVIXSAz vBsFQYoeU/GjPdToYcr3HYxYxNTIkmGyvuP5f3YBKCAFUJ3mgnebOHzeQQjthjERpgeo BXuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=a69CpnZLhKaGE1y0QOjVkguQ4McgCYqiRLiuKO0SAy8=; b=boN/KqSTRsvj1rxhTfcLC09Gp8b8hfx14FVZkDggGVwWpxO01++OCse7H05LtimQy6 CcdtS2QAhBVe96d+oiZdV/4yTQDB1cWSMVVXBIbt4ELjrKjQ3nuUEl+JILp10BVTBrhz vaQfulL0ydSATHZ9CCwe3bQYbVJyKCWK7sJOwkQBqG7dB6x5U3EusrNcpD85LzI3vaaJ PYw1LqLQ2Lcevhxwv9x4DZ1v4V0mwqfXn4QvVsfDHih0KpIS4roGH3zp7F7VtefRxgb6 gb2iHq3NkqVg7/+M2rTywnCf/08XfXV1iViCZ6AP6UtQ12Pt8LJ5xerObmgNqsn1Hxxn B8jA== X-Gm-Message-State: AOAM532cYDQLBkG+Megr7w7Xld6ldp+SpLDXZmE/fLNatpC+rhYGV9LN SdKxd/AlHLRZJzL7t4TILA== X-Google-Smtp-Source: ABdhPJwMgJpDqP2Zu3aVARiPmklrqVzcOSGKmzF5cBLo/EZlvLhWjlgVkYZbkyLFh0CPrqSrUzDOKw== X-Received: by 2002:ac8:3778:: with SMTP id p53mr18927663qtb.228.1593475957498; Mon, 29 Jun 2020 17:12:37 -0700 (PDT) Received: from moria.home.lan ([2601:19b:c500:a1:7285:c2ff:fed5:c918]) by smtp.gmail.com with ESMTPSA id m26sm1579630qtm.73.2020.06.29.17.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 17:12:37 -0700 (PDT) Date: Mon, 29 Jun 2020 20:12:33 -0400 From: Kent Overstreet To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, viro@zeniv.linux.org.uk, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Fixup patch for [PATCH 0/2] generic_file_buffered_read() refactoring & optimization Message-ID: <20200630001233.GA39358@moria.home.lan> References: <20200610001036.3904844-1-kent.overstreet@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200610001036.3904844-1-kent.overstreet@gmail.com> X-Rspamd-Queue-Id: 7F392180AD806 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: Andrew - fixup patch because I got a bug report where we were trying to do an order 7 allocation here: -- >8 -- Subject: [PATCH] fixup! fs: generic_file_buffered_read() now uses find_get_pages_contig We shouldn't try to pin too many pages at once, reads can be almost arbitrarily big. Signed-off-by: Kent Overstreet --- mm/filemap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index d8bd5e9647..b3a2aad1b7 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2220,8 +2220,9 @@ static ssize_t generic_file_buffered_read(struct kiocb *iocb, struct inode *inode = mapping->host; size_t orig_count = iov_iter_count(iter); struct page *pages_onstack[8], **pages = NULL; - unsigned int nr_pages = ((iocb->ki_pos + iter->count + PAGE_SIZE - 1) >> PAGE_SHIFT) - - (iocb->ki_pos >> PAGE_SHIFT); + unsigned int nr_pages = min_t(unsigned int, 512, + ((iocb->ki_pos + iter->count + PAGE_SIZE - 1) >> PAGE_SHIFT) - + (iocb->ki_pos >> PAGE_SHIFT)); int i, pg_nr, error = 0; bool writably_mapped; loff_t isize, end_offset;