Received: by 10.213.65.68 with SMTP id h4csp358067imn; Tue, 13 Mar 2018 06:41:42 -0700 (PDT) X-Google-Smtp-Source: AG47ELuVJYgEfDUgMBmO0nFhEfkqOiCANEj/qf6UlxkDMqpJKc/mkMiwn2BqP2f6creokOvodaHF X-Received: by 2002:a17:902:864b:: with SMTP id y11-v6mr620828plt.380.1520948502860; Tue, 13 Mar 2018 06:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520948502; cv=none; d=google.com; s=arc-20160816; b=zLbc+AkZCjk2m4XuQh4j7rQGzfOQldNdvOSKXU1taL0OiuAuveCLng+hkyBasE2fS5 aK/r/Dg5A0JbaA+LkZ3fRWdhZMZHLKa9q1MaytxpNfHT2GGcR0iU0DStPIeHiTV6BZPy Ufq1gsR0kYlIDZHv5VP9y5xE0oWe7EyQSaZxKXy9yXdJ1nbdpiRLj/LUiQfYerFuJlYr a67Zr0G3IwtLXa0Gc/hYNGjv0G+ajNfyQVQi1ly+bTQiL63xykvq7L3uD5El1mLdZpGu tmqMTxD9vxGE+AEjUgEhmiBFxMAjnqRHSVCH4hb+L+uoNYi4eG44Uwn/35XpjD2BZrZj NlVQ== 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=WFrOnpWlMxyHK+TcocscUhQSNXN36mC6U7YpeofUF8o=; b=P+6Py1Cw3fqRFVgy82AuV0oimqoO92cqzHMTlBcX/9Gncto0IEGlZ+M8tpkaEgYi2f zjE/DleGAg5K6MTcyZBsm9N30cUEOpC5e3w97NMd7hKd2sho5DBCtPd4oGQmamhppRi5 nMQI8DAi0clSYT7odwdhQzZqrIiaXxsTRq98nqD8r5yA4W0B30FvlTjsmlQBW6irnt10 9KrCnDe/J3wSmhb3rI7msAhFpTcwf5Dv+3RXqlElpeOtvEREHOS1MrYq0fOoBN5wdR9S 9TrpgYep4XMUm/fDerOyOIo+57c37wSSnjQT+oooLM+lR8xcc64iusqhWLNlilDZjVYv 2sQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=bT9kc+er; 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 32-v6si107657plg.555.2018.03.13.06.41.28; Tue, 13 Mar 2018 06:41:42 -0700 (PDT) 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=bT9kc+er; 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 S932903AbeCMNjt (ORCPT + 99 others); Tue, 13 Mar 2018 09:39:49 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:35388 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932533AbeCMN1A (ORCPT ); Tue, 13 Mar 2018 09:27:00 -0400 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=WFrOnpWlMxyHK+TcocscUhQSNXN36mC6U7YpeofUF8o=; b=bT9kc+eroyMNTOmE7+Vbf8NoX Sp7m/ZDGuJJT/A0zDr+Nn4Rqm9DDcEHVL5adtu+Q02LvwPibG+18FaCIRyKdsREeu2lkc9iDOHa/U KAy5mS5X//KP+HUean+Leln16B+TCNtIVCSrbHjEIzxtQ3mqOX6YB7yf0nY1fRprhTYdwTKj841A9 ZmIZQBhhtoxRyx65e9Bn6Ds98oaOzfBbVf3fQ3ebrk0+8ZjQQ164jisvXJa/2ufPzNZEPyAjuYNmL XIkWPdqfQKAdp+oKEYTWlKBG6EIBDS3GwpPMO6o69gzOfR2hp8rut6ljluOaAyX+mm6k89zO8OMrr kblqRwtUg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1evjxC-0004ie-SY; Tue, 13 Mar 2018 13:26:58 +0000 From: Matthew Wilcox To: Andrew Morton Cc: Matthew Wilcox , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Ryusuke Konishi , linux-nilfs@vger.kernel.org Subject: [PATCH v9 39/61] mm: Convert huge_memory to XArray Date: Tue, 13 Mar 2018 06:26:17 -0700 Message-Id: <20180313132639.17387-40-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313132639.17387-1-willy@infradead.org> References: <20180313132639.17387-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 | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 89737c0e0d34..354b7f768d0f 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.16.1