From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Wilcox Subject: [PATCH v13 41/72] mm: Convert huge_memory to XArray Date: Mon, 11 Jun 2018 07:06:08 -0700 Message-ID: <20180611140639.17215-42-willy@infradead.org> References: <20180611140639.17215-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=yMvq9C+7xk7yZk7cjnEEnp5fI210x4S9onkG7brkez0=; b=RPXyAEPeJFAaF9NCB8VS2EAUiS YMPCcU6jpvCSAa6/9J5Sto+dNJ1yXLjTZ23Id4dX4pT3DsdCKqXP49Tb6TPwOpHNFeRe4qbsuTGuz spJ7ZZaNjwrKvzV2iyfm/26WKs80FlMXprmDC3+Byn79Z3p/Lw8enyVAdGO9GM6VU93Q=; 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=yMvq9C+7xk7yZk7cjnEEnp5fI210x4S9onkG7brkez0=; b=cgvZTllFmBlah2N5oYF9j4RMiH TLwOMbO6zx8RRyu6llgF5SdRSAMvCtDoH4tjuh5PCYfZr17fXEPObfFjbz8B2ARVI0qVwMF5Q+Kj5 FhMblF2iTP/AkqnXwS14FGZO3cmoikYSxHWkvhPmJhULE6CF1hoWMzHYRvfdpx8F3jwQ=; 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=yMvq9C+7xk7yZk7cjnEEnp5fI210x4S9onkG7brkez0=; b=ThsXXNtlY6IPV9ZR2YAl6K5Se FWn+hSURSdwUDmvX687LlqYlpCYeDLRmJFEqYpl8rJWTB4p0VmOJB7eEzFXKCPk6gzyCwpaO3ZlR0 y3HUAt5NymLtJS5WL5WLoTi+Radwl4xIl5HfTZrxo37DBUorH7WcUX8St4Gufw+iTEHOZ8x5xE48t DAwBik0HH1MUJxycWDptrDFGu0n1SjFgO/UyccSBBWG7NVTHitCpARsVe+les9eecAIYOaPi8nlta jTgJ3dMPYcKQQaL6QKYF0cJV8bFYr/NXEgIMQCWQf0+dmOMJ+1GxfBYM1Ac7sScmBFKASCjzkGJdt iVzBqw4Ow==; In-Reply-To: <20180611140639.17215-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, linux-kernel@vger.kernel.org Cc: linux-nilfs@vger.kernel.org, Jan Kara , Jeff Layton , Matthew Wilcox , Jaegeuk Kim , Nicholas Piggin , linux-f2fs-devel@lists.sourceforge.net, Ryusuke Konishi , Lukas Czerner , Ross Zwisler , Christoph Hellwig , Goldwyn Rodrigues 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 d43394fadbfd..1dfa4542fed9 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2439,13 +2439,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); } @@ -2557,7 +2557,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 @@ -2653,17 +2653,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.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot