From patchwork Wed May 9 07:48:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10388337 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EB21360170 for ; Wed, 9 May 2018 07:49:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE0C028E05 for ; Wed, 9 May 2018 07:49:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2A2228E2B; Wed, 9 May 2018 07:49:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A4BF28E08 for ; Wed, 9 May 2018 07:49:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E3466B0346; Wed, 9 May 2018 03:49:02 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 36C5E6B0348; Wed, 9 May 2018 03:49:02 -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 20FAA6B0349; Wed, 9 May 2018 03:49:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id CCB396B0346 for ; Wed, 9 May 2018 03:49:01 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id j14so13166825pfn.11 for ; Wed, 09 May 2018 00:49:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=y2LLMdW2MOL+Nk8c+OFP/HzT+hNSXjd+ACc088jaOxU=; b=tVF/pIooIywOuM+szAjVbvrN3DI4eIRx9taqN0rPAHPI/pOZPWSLrhmLg7632TaO6c qhQQuTqf12Cu+TS8jDi9bEWXoOyrkEuTUhnk2RztrYyUyWPtXq+AB5HNO1276RDSKAzb 3DOF6l9waSA1cEa2DNIoh2x/IcMw7YAizEXJuB4dfpvIG5o6hGK3oCzZ1/4VjbyjGsp2 OUgzKPII88/L74sQSISSZnlCZdnMzcwyV+Sd4lO3stAKrZzF7M3+FN5ppbyAXyUJxVta 2vEhNXADTyx6Qm0LdNiXCEhc56zbLQrS/8N3LA/qZIAzcQlS+qjbNgyswzNXIq3c+ovI T0Vg== X-Gm-Message-State: ALQs6tCIK5oM83OreHZkzkEP2oKti1Xukql07rrpE6Y6ztnGUbq86bBW 4InaQmQIohWqlZSHguMFse+6tcoCFchdJE7AI2+h4f2BuqTDOG65KRaM08lXsKU1vXdcerCfMrw O5hL88LJBszC9VdzXeq6G7QUIqxFsbYL3aW8QMC00HPa0jNaRFgdAFbxX52jRKMM= X-Received: by 2002:a17:902:7487:: with SMTP id h7-v6mr43559171pll.154.1525852141545; Wed, 09 May 2018 00:49:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpTRqBmuA+/jjAExqf5f/PDqUBjRK99hV7zPLzTIFQFYsSP197jW/6jSU4PTPytc5L6CNk/ X-Received: by 2002:a17:902:7487:: with SMTP id h7-v6mr43559142pll.154.1525852140836; Wed, 09 May 2018 00:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525852140; cv=none; d=google.com; s=arc-20160816; b=CxuMfMfbjKiFsO/mPSdP6Lv+H4bHzbBLwZbdKgf77NjqH/0W6ey5jMvlKhIaiCa0zi YS2dOvey5sDfsFEAoOb5+PLAIntikFAK6tgWXfenEvOkbaSsxh+NytoCpQ/UTqdBSv+6 q4YIFI16pfcJ8fJpNOxiAS9/PF6lYEzHQbWzAAjuOsEcDrG1SiY+nj3CZXPYRXuPjy7p T+BcDFITGkz1iGyvy+1olPW1Uc/6l5V8SZXZfCV/LnosxPMrX0fJDTd82jijMH2nXmm2 nuP1TsuEO6nwrgFrRGiUiv1VNN13k5Wwo5cuKFAJP+Rz30e/+7VUcImL+mXWCdG0I6XW wMZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=y2LLMdW2MOL+Nk8c+OFP/HzT+hNSXjd+ACc088jaOxU=; b=vx6nZus4aP1ULsglQ0TyKkW8jglBqQL05YtHfXo8VsYfZiUCvEylWF1XZYqYtEGjVr E3eeeuTfNTnkletNgAuxRGbI/MkgQAW3Fmxlbn2aXCNwyADp8/Qkl+MxHNA3/x8mPKmo 1Hs0XDWf2yAxufKosSpnkhtadkoPxotwAIdnDkTtiiP2sgZmwOM4aPdyf+X8m6LVA0UH er0mwsQKR2A90/WOTlMuYDZB2Tq8h1ZlnpMJhzkexTxC/KgL27DexTQSzc1J6rXlc3h3 yam7kK43ZSFHIB9S7DKjpQkfJLQG50c51XI3qGlGvgFiUeg7yVeBBsli3fYOS8tJFqQO XhUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=jlNubqvw; spf=pass (google.com: best guess record for domain of batv+e0efdd19ce80d487e3da+5372+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+e0efdd19ce80d487e3da+5372+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id v80si14937264pfa.173.2018.05.09.00.49.00 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 May 2018 00:49:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+e0efdd19ce80d487e3da+5372+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=jlNubqvw; spf=pass (google.com: best guess record for domain of batv+e0efdd19ce80d487e3da+5372+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+e0efdd19ce80d487e3da+5372+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=y2LLMdW2MOL+Nk8c+OFP/HzT+hNSXjd+ACc088jaOxU=; b=jlNubqvw2vQNtQqHWzznkuc6V a7/T7fVjZV5xT/ga2+4n/WUNpLEwc+6Zsfdw91MCRyBVt2cZbJuHJiSoYg8kWwqrOrNbwZK6wwPWm yEloo6RyhvWL9xe6fERm+x05o1rC9rQ37CjUdvwhPmkC2dmS8+5M0yZwBTdqle8AL5oPcoqDoKliP 3XE0QaERKzeVZ/oM/6x8LLa0kL6XN2CiG6Au+vkLUPqCmZBk3GKzK4mvJ7h8f1Ulw0NR4MlXDrIFM vBu8R919qPR5z9eEzBwIgIJ4w2ry1C1Uwm79CEkfUG/5BKbHnKj5akRIzAYtFfwoMrRxcOgj1v5nF vEB2qsXtg==; Received: from 213-225-15-246.nat.highway.a1.net ([213.225.15.246] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGJqN-0001Q4-TZ; Wed, 09 May 2018 07:49:00 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 07/33] mm: split ->readpages calls to avoid non-contiguous pages lists Date: Wed, 9 May 2018 09:48:04 +0200 Message-Id: <20180509074830.16196-8-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509074830.16196-1-hch@lst.de> References: <20180509074830.16196-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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: X-Virus-Scanned: ClamAV using ClamSMTP That way file systems don't have to go spotting for non-contiguous pages and work around them. It also kicks off I/O earlier, allowing it to finish earlier and reduce latency. Signed-off-by: Christoph Hellwig --- mm/readahead.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mm/readahead.c b/mm/readahead.c index 16d0cb1e2616..3f608e00286d 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -177,8 +177,18 @@ int __do_page_cache_readahead(struct address_space *mapping, struct file *filp, rcu_read_lock(); page = radix_tree_lookup(&mapping->i_pages, page_offset); rcu_read_unlock(); - if (page && !radix_tree_exceptional_entry(page)) + if (page && !radix_tree_exceptional_entry(page)) { + /* + * Page already present? Kick off the current batch of + * contiguous pages before continueing with the next + * batch. + */ + if (nr_pages) + read_pages(mapping, filp, &page_pool, nr_pages, + gfp_mask); + nr_pages = 0; continue; + } page = __page_cache_alloc(gfp_mask); if (!page)