From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Wilcox Subject: [PATCH v11 31/63] mm: Convert huge_memory to XArray Date: Sat, 14 Apr 2018 07:12:44 -0700 Message-ID: <20180414141316.7167-32-willy@infradead.org> References: <20180414141316.7167-1-willy@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; 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=KlUzEW3LPsGf+HidaZxUjAAo5tEe/tqz+oHLisvTa2A=; b=Ynh1RyRuJI1I0I2q5bjvumeZjc ws0EtV8mTb3ug6bZ3xiHXuMOugEMbpFa3j0EM4hZq6uimMwN/RBACXJakM0XlcQh4Ywa5jc+tS9jH xEoY0kqXu0rHjlEP4W4+9vFq1KYBUlFD+OmAhriuZ2tijbwtFk1PxV202OY5c7nG4cMA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; 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=KlUzEW3LPsGf+HidaZxUjAAo5tEe/tqz+oHLisvTa2A=; b=P2bFv5JkfwQSsEA7e9NYvopzei LHh03BM9rkgJEKRlZMktoXU36EQvKZrmftG7rBYEF2GSl1qZIimYOeJH0Xtl9bVC4mNDfeICqFx5m 1TrEDDCu694neCPp2/NFnQd143qa3GWt2olOP0hAGKhM8IP3H/jK09QMOGZVZTOsqcYQ=; 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=KlUzEW3LPsGf+HidaZxUjAAo5tEe/tqz+oHLisvTa2A=; b=qatDNLFuanKx0xTuWAjC+IkrE Cup1XK+mLTLdATm+8mrICD7pP2qRzC5k0dH9Gr0tZtnBjY66sxplqrTR9JtD3N3O6SYC5pc6xmik+ Pfp9+4xwfxlcTDFoo2isUc/PBMBTUiw1EP4joQjlsV7wk22XcTkbgDfKZkZibIFzsM7hphZltDIAb eSSC6Xtf0KXY4vVCdJwUAhr/OiGNO3XdIVirqkhvYPQBccaqK7VJ8b6PPCucUaIHzuskIoK5KY3Jp lY/8tbfEJszOp5noc5DbYAzjUUuR3gtpHwm8upSs9UvJ9It3+LSjIIQsWHtD1I1lDUGLnGMGUdJ0r YLvztGrQw==; In-Reply-To: <20180414141316.7167-1-willy@infradead.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: linux-nilfs@vger.kernel.org, Jan Kara , Jeff Layton , Matthew Wilcox , James Simmons , Jaegeuk Kim , Andreas Dilger , Nicholas Piggin , linux-f2fs-devel@lists.sourceforge.net, Oleg Drokin , Ryusuke Konishi , Lukas Czerner , Ross Zwisler , Christoph Hellwig , Goldwyn Rodrigues , Mike Kravetz From: Matthew Wilcox Quite a straightforward conversion. Signed-off-by: Matthew Wilcox --- mm/huge_memory.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 14ed6ee5e02f..f2d6b53cb8e9 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2442,13 +2442,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->i_pages); } @@ -2560,7 +2560,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 @@ -2656,17 +2656,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->i_pages, page_index(head)); - xa_lock(&mapping->i_pages); - pslot = radix_tree_lookup_slot(&mapping->i_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->i_pages.xa_lock) != head) + xa_lock(&mapping->i_pages); + if (xas_load(&xas) != head) goto fail; } -- 2.17.0 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot