From patchwork Fri Apr 14 14:07:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Ryabinin X-Patchwork-Id: 9681293 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 CBE7360326 for ; Fri, 14 Apr 2017 14:08:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDCF928695 for ; Fri, 14 Apr 2017 14:08:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B286E286AD; Fri, 14 Apr 2017 14:08:17 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 452E528695 for ; Fri, 14 Apr 2017 14:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753294AbdDNOIL (ORCPT ); Fri, 14 Apr 2017 10:08:11 -0400 Received: from mail-eopbgr50102.outbound.protection.outlook.com ([40.107.5.102]:35712 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753063AbdDNOIH (ORCPT ); Fri, 14 Apr 2017 10:08:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=WEc2u2hiJuiiGAepKFBWkhWmkG8ysKNrHyu+aPW3g48=; b=f4zmyCIspdkUd8Kqe2l8Q78wQ+6eiiluqOsEN/ytlbIa2+BxLA26q7fxtIusdvpOqirQIGlru8v1U+gWWWNpEfBIwjtdMlLUZM9jTo6V3MPEVxXBdkLJobPr/D/z1biHTpkByIQGAKQmj/1eZbKhTrPDKLGmyGxhrAT+Vl+0iLg= Authentication-Results: zeniv.linux.org.uk; dkim=none (message not signed) header.d=none;zeniv.linux.org.uk; dmarc=none action=none header.from=virtuozzo.com; Received: from localhost.sw.ru (195.214.232.6) by HE1PR0801MB2732.eurprd08.prod.outlook.com (10.169.123.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Fri, 14 Apr 2017 14:08:00 +0000 From: Andrey Ryabinin To: Alexander Viro , CC: Andrey Ryabinin , Konrad Rzeszutek Wilk , Eric Van Hensbergen , Ron Minnich , Latchesar Ionkov , Steve French , Matthew Wilcox , Ross Zwisler , Trond Myklebust , Anna Schumaker , Andrew Morton , Jan Kara , Jens Axboe , Johannes Weiner , Alexey Kuznetsov , Christoph Hellwig , , , , , , Subject: [PATCH 3/4] mm/truncate: bail out early from invalidate_inode_pages2_range() if mapping is empty Date: Fri, 14 Apr 2017 17:07:52 +0300 Message-ID: <20170414140753.16108-4-aryabinin@virtuozzo.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170414140753.16108-1-aryabinin@virtuozzo.com> References: <20170414140753.16108-1-aryabinin@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: VI1PR08CA0039.eurprd08.prod.outlook.com (10.164.95.49) To HE1PR0801MB2732.eurprd08.prod.outlook.com (10.169.123.152) X-MS-Office365-Filtering-Correlation-Id: a497a473-7812-42a0-3362-08d4833faa28 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:HE1PR0801MB2732; X-Microsoft-Exchange-Diagnostics: 1; HE1P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Q7UhunK9ADAw/SjEFMkhWk4dp4nkuCB2QsQBlfB797; 20:sSzOI4Zj36SP8soGfZ3Cku77Z3CFLTrr9M2jMjvhzWXBpZOmclZM+aZ/mROTTw+2ihhD6Nkw63dX4OvFP/09poCY5BSdGJO0e5Iuu3z4tdnOpTZoPebLmmKqrvFNwmEgVMyL8OdwYcPhyEmqePwJE1fwC8KwdIeSuBIADMlyFgSmoAezI10t4J7tWEighHZ8D5Tz2UWPZawFJCtnNp6xkCNI6NYNXLL6Y2QHRzoQ44jmF+AU5kPeVRkUP+TPBFC4wybdcG5uJYvmuOefoGb4maMEzHj3HVKSLyONKL3s4y6nDu8594Sry/brKx/DQjw9y5IohjAyXq/Ym+WElTaIB2FxvKoX3V5pC3WNno34dGtcsvcq4m4cJPFbfa88sBP91NoDFCTRttFUBdhEIWbl6UhPVmW7Hf3maceovQWSjI8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123555025)(20161123562025)(6072148); SRVR:HE1PR0801MB2732; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB2732; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2732; 4:g55P8W76C8epkfdYl0+9i3258YUxf4Igt+h2IsiqJZjP6qxE9hfqFwjSmwYnXLzta8lLXcGaSzK2y35IvW2eFW277955qQ4Fl9ZuKKjTqLMRZQu90RXtreSHmOwp8YYgKmKgheF9dtQbpL1ecyro43AL39yUJmGk/0TKXzwN24o9JB6ZemWOaikRI6N2VC/UU3U1WR4XaV+isBx3zjsQa4LSd4fS1i0nJwiqQraBJu4e7XM7CAmEdG6cO8x62Hz0g4hf7AmjZLxxZDCRvGul3kf9f+jbMlUF9RnOAXL4yHJfgrOra41hBS+4gMLsCbvB7n2Vq9ZICshJ/WBWWy1UOy3i/oWOz/YYb6T7Wcak3zP0Jpab6OyhKjBL7wz7N9jfqD7PytobkwEpZJOo6hrzxo04J7S96bHaSu9DafVBxLZLvINXkljeZZ+yRD3tCT4NEqRkxRq3oCqbH9V/yY+812f01xUP83uXTpYW1P0zwdt9i979REFzoA3F6SCtsKS6ghg2fd5gZMiNa7dEGQv0gqYGFFBIg+BvVJrmwYBLb5HT/qFaZfNn6tLzY50NLKp3mPiUpurBTcHzFgFhvHSKydk0f1XQY2+daN4/28gWaDIgOVH7UtfZCwDbei05e/3dwBbEn3sFQu18khwMXwgppPQcJq1GSjyMvKNDBR3Myy2uj1z8L4NGQ5+43h1YsyQdauIrLhOZffoj6Eoc/PWDjA== X-Forefront-PRVS: 02778BF158 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6069001)(6009001)(39410400002)(39400400002)(39830400002)(39450400003)(81166006)(6486002)(86362001)(54906002)(7736002)(575784001)(305945005)(50466002)(66066001)(47776003)(6666003)(5003940100001)(50226002)(48376002)(2950100002)(1076002)(33646002)(53936002)(5660300001)(4326008)(6512007)(50986999)(76176999)(7416002)(25786009)(53416004)(6116002)(3846002)(8666007)(2906002)(36756003)(8676002)(42186005)(6506006)(189998001)(38730400002)(76506005)(15760500002); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB2732; H:localhost.sw.ru; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0801MB2732; 23:JyYcEgiF5CC83lcLJJE9Bdm/sLHZYqVlKFHxohs?= =?us-ascii?Q?xThSUEjvPF1Vm37KA+EZQDB7jSZS6b+bSIaqHodaUFp7ORzx6eDQWEiBSsXh?= =?us-ascii?Q?EwoTWyjenfBcBheWvMV+EAp3e1JQ9Dm9+MgjMOzUvZRNe5VqnY7KwW5/mu2a?= =?us-ascii?Q?7NPa6ibtbizoKPqa/xqgz5vLQATD5SD7T/o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t0tgW6fkEE8yAnOoEu060XkXpS6QRiRDUWKxBG/oupBV+Ch4I5xLjgigclPMCQI/ZECj9mU2gfKWkD6R2Q/ImhZXCQNyvM1V+LRu6fHGn8u04G61bdPvovINyvxa/8zQLy9xbCYb1i8tTIwpKvGinjyXVl2IwCFRrrm8qoOxk09xiAfomrbvDKA3nEDRq6XK1RzZm1cdmKpCPNLP3nsw==; 20:maJ1Q+mqqLqDccDemMQIx0FkkC6wJr0C/gNda+rBxnPW57JuklqKg4nckOU5MHbxt/mlTX5vE4xE3hEnvZ7q58OihrDPGVpwsQzzkWqZKAN9lkT0F00wbJaIAZ+0QOEmaFBIed37fn12w0TyWCOhdLf3rdySDCd4dqvnxK0uspc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2017 14:08:00.0615 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2732 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If mapping is empty (both ->nrpages and ->nrexceptional is zero) we can avoid pointless lookups in empty radix tree and bail out immediately after cleancache invalidation. Signed-off-by: Andrey Ryabinin --- mm/truncate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/truncate.c b/mm/truncate.c index 6263aff..8f12b0e 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -624,6 +624,9 @@ int invalidate_inode_pages2_range(struct address_space *mapping, int did_range_unmap = 0; cleancache_invalidate_inode(mapping); + if (mapping->nrpages == 0 && mapping->nrexceptional == 0) + return 0; + pagevec_init(&pvec, 0); index = start; while (index <= end && pagevec_lookup_entries(&pvec, mapping, index,