Received: by 10.223.185.116 with SMTP id b49csp4141361wrg; Mon, 19 Feb 2018 11:55:50 -0800 (PST) X-Google-Smtp-Source: AH8x225Ao5iTQEsP2Sskdpj4aa5UTEU1Ufwz5W9+VnYGbhsRoo3QG8qU4flK8pLbyvdPzPstgnJT X-Received: by 2002:a17:902:594c:: with SMTP id e12-v6mr15441493plj.323.1519070150507; Mon, 19 Feb 2018 11:55:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519070150; cv=none; d=google.com; s=arc-20160816; b=ExMaOiIst+Xdw08gbd5BOdSP9X5xD4g2aiiSZR9k0JMBQSo/riJy0LvZ1Nm7znGQsH 6Fn3aNzhvDrHVcTgwO1YiwgiPQJQXgG/Hh13d+lwtvixiERs05/81HAXH+bUdLLf7qJf 87Opqfoffn/kJNEK1g75a0/dKFHoQYL/1lpBj6xDE7oicgb6wAgGrYzwgUxOXmIgZgF9 2YEiSiENbCpOQkK0wU+2+PF7suphJU4WR6oBZ6fmFaGSfI2D/s2DtdKORv8cJcwYeC9O spMynT5mmG1G/Oj3I/AnnQsnz6c87UZcdgxPSzH4E0n3284CP/DoqtLwmR+m7OES/taO 0KjA== 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=8DvDMX44TJsIup+Ut7reZB+aPE5qClPfLqZjLBctq14=; b=vkssdN2xviZDR5qTKv9uhM3KTNLtt7Ck2WyACGe+j4dSPh6k/LrjCcbBR2lIn0K4lv rJJwIpFZE64ivBmuROCbfDfqxoHanf9K/UW6xwH26IGyfsBQfM65YAgELuX5eG4O054+ 5kHmT1nWbo1q21Ez7A1LPDxoVvL9xdSqHzdYP2H2S+qFXle/Z78NFr65rJpzcxWNbFjN 2e9ExdEOkOtJgx0u258ZfQOE4wl5/Virc9x2KuV1ynM3KsZ40Kn96cU5qBsQrAkUZhJt nbp9BVNTP3SCLewViK+nqx3SPku2o8S+AK491UXdiDGAoY0KjC56WtfdAonD1zwfWdFr t9hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=oxrTh0BE; 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 t24-v6si2757704plo.340.2018.02.19.11.55.36; Mon, 19 Feb 2018 11:55:50 -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=oxrTh0BE; 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 S1753901AbeBSTyB (ORCPT + 99 others); Mon, 19 Feb 2018 14:54:01 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:44904 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753531AbeBSTqX (ORCPT ); Mon, 19 Feb 2018 14:46:23 -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=8DvDMX44TJsIup+Ut7reZB+aPE5qClPfLqZjLBctq14=; b=oxrTh0BESR5WDHWQ1mzcvmivS VKTGNxuNxBWhCppcBXbk3+D38rz4V7XD2OJjobAB2+pC8ovdxyKrB48bu5VyO6hvJG8OJklTf1BBS MhQ7EnarOSFKOSBOso69AdebeVdiyxgbJNcDbWhyos9isUAzyjES2mginLrCcj0S8Rsg2VvJfQDfL bF9/2+JgG5qwMGwj1jrFmF2SvHwD+N9FyAdtjX1I3qrtxBre6gVtAJJ60Jm5AFoX4Rua1UT/aFfP8 QsMGW0/DvM+ekl50xwFv3Gr7jxUWaVsYTgPZd8+5XwLN6XyJCjW/W8ocmFALeV1+ckoAWfgZIwLOb CwhPPoS+w==; Received: from willy by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1enrOI-0001sR-2E; Mon, 19 Feb 2018 19:46:22 +0000 From: Matthew Wilcox To: Andrew Morton Cc: Matthew Wilcox , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 40/61] mm: Convert huge_memory to XArray Date: Mon, 19 Feb 2018 11:45:35 -0800 Message-Id: <20180219194556.6575-41-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180219194556.6575-1-willy@infradead.org> References: <20180219194556.6575-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 4b60f55f1f8b..e0a073f0a794 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2371,7 +2371,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); } @@ -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->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->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.16.1