Received: by 10.223.164.202 with SMTP id h10csp666051wrb; Wed, 22 Nov 2017 13:20:24 -0800 (PST) X-Google-Smtp-Source: AGs4zMZEwC8LAWhrE0AwmvrSIPyux2eRsUyx4BuL+HPE5lSIpPDDZaI1OTSnKxz+X+7teTBu6q1K X-Received: by 10.101.86.133 with SMTP id v5mr21689229pgs.266.1511385624745; Wed, 22 Nov 2017 13:20:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511385624; cv=none; d=google.com; s=arc-20160816; b=cy4gB8i3LxuBBj0O5GEKFSWUchRjkuCk0UVUFAH8vkRa0N4NoOjmwRYIm6l7Xvtu7i NM+Vuu4EzG2LNGKR4A6AJK1GaHlZe2MK6fQDXMBeAqBeezFkyQ6cEyHJG2hSq3UqUq4D Gp1BgjFd0pzjjouijKht+Hk0X9vjfpiUcOGR7VBKSH2eHvlFi6nzsdfWaNWWd9QYMRZ1 KdBR3nUGEXfGDkrPUSt8aAnPrgKwNKeMngP/yE8SUnBLleRLmrldIOqghZIv7q9eMqnO 36dl7FTJL1iExYn3dVHl5JaEghJdq0hjIp6u6oE0Cods7W0l3rrz7crWV/NkCES/RjT9 o+KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=/miunpPkFrWqMBNi/3F6d8GSXv+cJUAz/frySTF6wDU=; b=jY9K6gjFcwX9GslhMbYNbyYXPC7BMIlcTXqU9jO9vDAOnF7dDbOqKDAkhKLmVflpI4 WScRPLXnO9ik4fIfH+COGxPJkzjEIDlkb/qCqpGaLkfI9G+jqGcpgKzMOIsYUSfbYBMl ww4aXU9nlC1V1HWhBSIP8OPndRt+qdVpPU9Ouz422a0aYtIPjnU19wXEcPapbLEMSmv8 dt028RiqcRmP/CWnHEa/dIOA5BO8+Y4UNWtH0uDji16dJFbCPu1zi6O6+KcmirdTrmLu JyZwqAn2/PTWMHZTyAbqG4oRLLMmhgTr5WkCaPD52jCxsHdW1C2n4Ap47pYVtrrr6weY 6gAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=E50U1TZO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n24si14388669pgc.513.2017.11.22.13.19.50; Wed, 22 Nov 2017 13:20:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=E50U1TZO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751715AbdKVVSS (ORCPT + 77 others); Wed, 22 Nov 2017 16:18:18 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:39404 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751799AbdKVVIS (ORCPT ); Wed, 22 Nov 2017 16:08:18 -0500 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=/miunpPkFrWqMBNi/3F6d8GSXv+cJUAz/frySTF6wDU=; b=E50U1TZOsvMmkqbQa5vol+XpG fiIOc0wb/4DnVugFvuAM63+0Ppj4DgBHKoc0vlO6r3GiVPC+bBT99zJx3wsvUbIUWQ0KH1BROwyzR gFhDtCqrmPOaMKtZCu9WdRFoeyOznCMZGjWc/twoFZW8YA0u4F3yR2fU6y/9WPs+CCoLXjpbnmOX7 9UdrEbMXg2ff7+cmUCaf1cwhJeFbmRIx4rBd01kJt6ffa9/vqgvjqbdxSXcMEQ+5Megw9jIv3RfJM tRxfRknMIrm59cpHpRtEIc0vjDZ5M3nqzkMfmN6YBbMMMv58wZwz3m0hju4ULp6ZPSEpTEmY7iRku REUB2yhuw==; Received: from willy by bombadil.infradead.org with local (Exim 4.87 #1 (Red Hat Linux)) id 1eHcFm-0007v7-8Q; Wed, 22 Nov 2017 21:08:18 +0000 From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Matthew Wilcox Subject: [PATCH 33/62] page cache: Convert page_cache_next_hole to XArray Date: Wed, 22 Nov 2017 13:07:10 -0800 Message-Id: <20171122210739.29916-34-willy@infradead.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171122210739.29916-1-willy@infradead.org> References: <20171122210739.29916-1-willy@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox Use xas_find_any() to scan the entries instead of doing a lookup from the top of the tree each time. Signed-off-by: Matthew Wilcox --- mm/filemap.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 1c03b0ea105e..accc350f9544 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1349,20 +1349,15 @@ int __lock_page_or_retry(struct page *page, struct mm_struct *mm, pgoff_t page_cache_next_hole(struct address_space *mapping, pgoff_t index, unsigned long max_scan) { - unsigned long i; - - for (i = 0; i < max_scan; i++) { - struct page *page; + XA_STATE(xas, index); - page = radix_tree_lookup(&mapping->pages, index); - if (!page || xa_is_value(page)) - break; - index++; - if (index == 0) + while (max_scan--) { + void *entry = xas_find_any(&mapping->pages, &xas); + if (!entry || xa_is_value(entry)) break; } - return index; + return xas.xa_index; } EXPORT_SYMBOL(page_cache_next_hole); -- 2.15.0 From 1584027715883573688@xxx Tue Nov 14 08:02:29 +0000 2017 X-GM-THRID: 1582324578228673612 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread