Received: by 10.223.148.5 with SMTP id 5csp6389592wrq; Wed, 17 Jan 2018 13:01:26 -0800 (PST) X-Google-Smtp-Source: ACJfBosF8R//f/46Z2wgBADetelaQJFAlT2ReSsN9/ADVzO1JRGcFixssLmG9o+xkX8vmvnR12Nu X-Received: by 10.84.139.1 with SMTP id 1mr42780494plq.250.1516222886662; Wed, 17 Jan 2018 13:01:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516222886; cv=none; d=google.com; s=arc-20160816; b=U6P50TgXquMYHOLpz6HnYs8tM68QaVOUn+BSCXJUpt2d4xZv85dKTVSdw8mldQWPE5 5yL9GRhVYz+c5dW0v3Yo3sD/D5fIH8L4GugxBoq2eShNvCJmSVITTrD4N8K2/ZRItgls OFzJBPhSrOLaXfOSwaulQAN4KAj9GvQrkPJVjBaZWBYNaqgXjEgoDVnGxKSjSCDO04a/ yUe85aBgtDy8GgxaZkMeFQG/gInm7hnHjo9Gnx9LQiH+aNSCB/mYNu4QhmovtL9/PByT JXINGD+LLLfD/rnSefh1fCmD2ZINjpPPtNBPmrG/jr9YlR2uAlenWGItITrzE0Xzkxxb gUvA== 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=rAYa1YOy3vh7kOTS6KP7uHSLmuSyisoLLvfiQIO0r+A=; b=eUwjd/EWfv6z5p3mzDPGY0qpHW2/YQImQP07hjnZUTYDD4eOdK8r2hHO/2RVWY8RtA pSuOWA9iCCl6ZJd6xztCqK543Hn6iNckD9TNkbl+LmdT2/dUPYlVcxgT34DTb9LN3uKC VtV0vx1aBActln5qEaHFne8UjEu1Zz+cGf5ytwN9QRIPpZnDx5LI6Dt6jZ46P3vhgUks eAjqLWmdnsQBMuIsx111tCZBiwOYVFZ2SW7ZTRjXH30/JpMbjVpy6z6RJEwB65pIVa6G r5rgvik3tgc/5MmqNp/kaM5aoKZkhztSPlXqaRJ/erKXeSjNiUwppfxWERK2O6xqVhTn yO6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=WiF0JYXg; 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 i1si1451066pgv.412.2018.01.17.13.01.11; Wed, 17 Jan 2018 13:01:26 -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=WiF0JYXg; 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 S1754943AbeAQUzE (ORCPT + 99 others); Wed, 17 Jan 2018 15:55:04 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:57113 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753638AbeAQUWj (ORCPT ); Wed, 17 Jan 2018 15:22:39 -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=rAYa1YOy3vh7kOTS6KP7uHSLmuSyisoLLvfiQIO0r+A=; b=WiF0JYXgFZMjryAe/3z5+0uYv RA5fGTFVd/NwesfIx1Jxvnkqwe055rmNTTuoeMpcTk5avcDc2ST7bULC+FPQ6MzRExHuzs3jNGTgZ WByecIHkc2LpqfYZxYnWJnjbnMxiGh75Llr8ttDSzbyAN8SLrzDWaBTgZP6HfEriNe5hOaRb31mlD xTd3WnnxofFX/Ji7sitReDZuEUrXuyhi4ViMFrL1spQg8XhiXHayeyUn0XS8tczjngdKwAUjWblwe jfPxZLURc8Yarf8BDfjFfn4Tbh2iggPNNULilg8Y6Ou+IO0t6skNpIU5Ty3AsEe0Sy3tW5GDmsoVP oF6WgMBdw==; Received: from willy by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1ebuEI-0005pz-PX; Wed, 17 Jan 2018 20:22:38 +0000 From: Matthew Wilcox To: linux-kernel@vger.kernel.org Cc: Matthew Wilcox , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-nilfs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-xfs@vger.kernel.org, linux-usb@vger.kernel.org, Bjorn Andersson , Stefano Stabellini , iommu@lists.linux-foundation.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, intel-gfx@lists.freedesktop.org, cgroups@vger.kernel.org, linux-sh@vger.kernel.org, David Howells Subject: [PATCH v6 37/99] mm: Convert huge_memory to XArray Date: Wed, 17 Jan 2018 12:21:01 -0800 Message-Id: <20180117202203.19756-38-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180117202203.19756-1-willy@infradead.org> References: <20180117202203.19756-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 Quite a straightforward conversion. Signed-off-by: Matthew Wilcox --- mm/huge_memory.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index f71dd3e7d8cd..5c275295bbd3 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2379,7 +2379,7 @@ static void __split_huge_page_tail(struct page *head, int tail, if (PageAnon(head) && !PageSwapCache(head)) { page_ref_inc(page_tail); } else { - /* Additional pin to radix tree */ + /* Additional pin to page cache */ page_ref_add(page_tail, 2); } @@ -2450,13 +2450,13 @@ static void __split_huge_page(struct page *page, struct list_head *list, ClearPageCompound(head); /* See comment in __split_huge_page_tail() */ if (PageAnon(head)) { - /* Additional pin to radix tree of swap cache */ + /* Additional pin to swap cache */ if (PageSwapCache(head)) page_ref_add(head, 2); else page_ref_inc(head); } else { - /* Additional pin to radix tree */ + /* Additional pin to page cache */ page_ref_add(head, 2); xa_unlock(&head->mapping->pages); } @@ -2568,7 +2568,7 @@ bool can_split_huge_page(struct page *page, int *pextra_pins) { int extra_pins; - /* Additional pins from radix tree */ + /* Additional pins from page cache */ if (PageAnon(page)) extra_pins = PageSwapCache(page) ? HPAGE_PMD_NR : 0; else @@ -2664,17 +2664,14 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) spin_lock_irqsave(zone_lru_lock(page_zone(head)), flags); if (mapping) { - void **pslot; + XA_STATE(xas, &mapping->pages, page_index(head)); - xa_lock(&mapping->pages); - pslot = radix_tree_lookup_slot(&mapping->pages, - page_index(head)); /* - * Check if the head page is present in radix tree. + * Check if the head page is present in page cache. * We assume all tail are present too, if head is there. */ - if (radix_tree_deref_slot_protected(pslot, - &mapping->pages.xa_lock) != head) + xa_lock(&mapping->pages); + if (xas_load(&xas) != head) goto fail; } -- 2.15.1