Received: by 10.223.164.202 with SMTP id h10csp663776wrb; Wed, 22 Nov 2017 13:17:41 -0800 (PST) X-Google-Smtp-Source: AGs4zMZNHxWwdQKgfBH6W/qu19bUUGSJdrukvsJ1LZG8I072zL+JQl9201PzYMhWt6yMpzLs7dV0 X-Received: by 10.99.138.194 with SMTP id y185mr21637790pgd.290.1511385460998; Wed, 22 Nov 2017 13:17:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511385460; cv=none; d=google.com; s=arc-20160816; b=mhHQsgUtbc17KmsWl4yl6CG6Li1WpDkEMslFu7AcL/E+nkEBh4l4Hb2Ul6C9k340Pv U/PcVN+Wdl5TXeizqJmc5o5L3MPqCqIiKvq3qjidgY6fZEMuyYggTvHd+m00PQ/C3l/E gyn+6u4bz351Lp50Nh/iuQKEsRbyt8otL2HInDUs9fK0utCzmVsvNU838b1Wi0QTr1pb ZdGvxi8dU63Ogbv9r/XLiKsutU2eTdkWmmj8/+H9iMOB73+rbOKjRqdjCqKlcZgYqjh0 0igNm5hXk5x55kJQhDZE26zT1MWFgFZiYdbN4R4l90aoYgW7HW4nHGM6/DVkaPm3cbyg UCQg== 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=DkCPapX6374UB5LOeN5lWNBxKWuBbP3qcVQ+U5s0nRY=; b=UDZ68QKwQ0CoYmomwO8t+nqgIwTOyi52baojZGz8aOqKV0q4p9mouSUu2dpZYUUhdS L57sYpJ8aBJEaBbe/Olb0YobbOnRVWGwLCLxILlNbcd7yXm4nfVS7PObqZ2onMDRczmC OETMiV5nGq8T4jgMynVFV4oihIvLtdDceTY1WYVR6m4EwiHZdiKxo5NyhLP0iqz/2osa hVlqcDp0KGc7E8XeUasmLXfZgSIWxAzmnn6Y7yURmMib9CWLCip9JtngehgBkXyR3ytt qLJ1qR4IxOt/lBPzyQbKxSHnJwECOWQ3k8wQg6/t1Ff+7yhTupIAsIzoyDqfZhl36CTE ZsvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GhhTscD8; 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 n8si7585376pgf.450.2017.11.22.13.17.29; Wed, 22 Nov 2017 13:17:40 -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=GhhTscD8; 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 S1752281AbdKVVO3 (ORCPT + 77 others); Wed, 22 Nov 2017 16:14:29 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:48263 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751822AbdKVVIT (ORCPT ); Wed, 22 Nov 2017 16:08:19 -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=DkCPapX6374UB5LOeN5lWNBxKWuBbP3qcVQ+U5s0nRY=; b=GhhTscD8Cm283ioV5L+SXImOQ 8dVaKFHDi+eIB9MysCn33hu4mCC1XbN+cSH9wgQE1UwMYohn9a7BZVX+hOqQ5jalC3OFOh8ORhdhK 9aX8VvqTuxzubvhkj6YUdgjFd8wxOQuB1n+OZgRS9+r+mSqQc24XYR7YSuzvKdvQcBbSsR5VyITbd PnKf82Rw6qmmLVkXFoW267j71vYBHnsEMBhRy5LXkGWSiEEa3F1UtrNAEJBvQFc7f029McncdDlq7 JMaBYtee0ahax5ix5gKcKg0z/q5XCX3zg3STxjRTxS8Af0m5HSwRKGbSteOgBeqdvAfewVNR5pIKW kOkxFY+Hw==; Received: from willy by bombadil.infradead.org with local (Exim 4.87 #1 (Red Hat Linux)) id 1eHcFm-0007wN-Qs; 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 39/62] shmem: Convert find_swap_entry to XArray Date: Wed, 22 Nov 2017 13:07:16 -0800 Message-Id: <20171122210739.29916-40-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 This is a 1:1 conversion. Signed-off-by: Matthew Wilcox --- mm/shmem.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 98944cff6319..b6f7fc283aad 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1076,28 +1076,27 @@ static void shmem_evict_inode(struct inode *inode) clear_inode(inode); } -static unsigned long find_swap_entry(struct radix_tree_root *root, void *item) +static unsigned long find_swap_entry(struct xarray *xa, void *item) { - struct radix_tree_iter iter; - void **slot; - unsigned long found = -1; + XA_STATE(xas, 0); unsigned int checked = 0; + void *entry; rcu_read_lock(); - radix_tree_for_each_slot(slot, root, &iter, 0) { - if (*slot == item) { - found = iter.index; + xas_for_each(xa, &xas, entry, ULONG_MAX) { + if (xas_retry(&xas, entry)) + continue; + if (entry == item) break; - } checked++; if ((checked % 4096) != 0) continue; - slot = radix_tree_iter_resume(slot, &iter); + xas_pause(&xas); cond_resched_rcu(); } - rcu_read_unlock(); - return found; + + return xas_invalid(&xas) ? -1 : xas.xa_index; } /* -- 2.15.0 From 1584797676658674181@xxx Wed Nov 22 20:00:40 +0000 2017 X-GM-THRID: 1584797676658674181 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread