From patchwork Mon Jun 11 14:06:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10457955 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65098601A0 for ; Mon, 11 Jun 2018 14:09:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 532472835B for ; Mon, 11 Jun 2018 14:09:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47AF528451; Mon, 11 Jun 2018 14:09:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA3DF2835B for ; Mon, 11 Jun 2018 14:09:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 971FA6B0289; Mon, 11 Jun 2018 10:07:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8A7F26B028A; Mon, 11 Jun 2018 10:07:00 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AF096B028B; Mon, 11 Jun 2018 10:07:00 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f69.google.com (mail-pl0-f69.google.com [209.85.160.69]) by kanga.kvack.org (Postfix) with ESMTP id 0F37B6B0287 for ; Mon, 11 Jun 2018 10:07:00 -0400 (EDT) Received: by mail-pl0-f69.google.com with SMTP id p91-v6so12108304plb.12 for ; Mon, 11 Jun 2018 07:07:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=yMvq9C+7xk7yZk7cjnEEnp5fI210x4S9onkG7brkez0=; b=nPoHmrsM+Uy1D1mR+5dv5nN6N0pqo9bX2mExFGbq9N0wZRfLl+ndGG1nLF2q4DPPS9 wLkSQAVelfczbfCF7Bc0Whk0wbTafjSbWVYqrMsbCONCGy7/fjpq6w7O+HiatVf5i9fW rUCB3ZIRSEZn4SDMVMV6iPoeDfGwUabjI+Fig6K0Oxcrxa0Aec0lJrdB6P6YBCULsVT2 kvAlceQb6TbBcVr/2EJDXuJn8Q2RClBz4ofExQ8PeCljGzNM5oED5uwRoMdFeuOxHwFA X5KsiO56SFFM0z2/x9ePiEAWijX438gt1LkGOnrP/CspLi+vXNDEKvmKfpxZ6TX/XPIY PExw== X-Gm-Message-State: APt69E2jI7Lpnm2W8qgmPmmc4g4M/2vtyGVEos4WO/+NU/4XQEa82Dat S9xA8Z3uCuX7fBMV4ZbyAthMdF0zL0BWbKCI2hWrXot6DTfHwwOAShwB5pqm7lR6E5t4aO2GcjV dYNd1c9tuWtqrmd047MB3EP4qBWsRFaPp5GwMEe0FJv1s4k8mWS6vtGiEFo09eOFlag== X-Received: by 2002:a62:2044:: with SMTP id g65-v6mr17830013pfg.40.1528726019758; Mon, 11 Jun 2018 07:06:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK1Hkyax5MvBXK9XTlAlhY75vzQI4QwwrHxgevFlUwo9TkusP2+KzM6zMwY7qhgbca61VHO X-Received: by 2002:a62:2044:: with SMTP id g65-v6mr17829957pfg.40.1528726018917; Mon, 11 Jun 2018 07:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528726018; cv=none; d=google.com; s=arc-20160816; b=GN3JqE09MhkZCQYYbDMwiZfaBo3UAY4t+2+ZphlgWqmIEUNN0EKikiamn6gJl9jhI2 ojXRlHCD0Z51UCuPQtoZyZx3WBS8uzIKe3/lKv5R76G4HeGHn5+4pjmGsLvxx41FDBwj sHGrBw2l/W5Ffz135XVSfL6WIfkHoDmQvmIxFSJIXThde0FZ3XqUylmOcWgMvoTXUypQ wERkWY0HOlDGPAyf/9dqnWdstWz8NHFLVcL0Wyfluv0REjDyhxXyk2UY5MTFMTmZMZVh Uu1EWwDHOb2d1S3UmYXUy+v/PnH17MRqYRQvqBILmsX86awdPC5XIznhZbgPSiUd6YrW pdIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=yMvq9C+7xk7yZk7cjnEEnp5fI210x4S9onkG7brkez0=; b=jXyVL9QoO0G2ArZgEfN8HK9TCUJ9P1Y3PHH061AIGxZb/9Fv9pm7JKcqUaRDqQ0l9l U5K6u99IWwvOP0RfYpSI2QJLMmqFv3Q7vxVR60bU6r9lDEwt0XJK98zr2gTXJgYQvBI1 64v3wW//90yfLQnYV2kN3P6EmBFFPOHN4LsTYhILT48EH5S0WsfdkyLFeX8HTkPgnjSu 2yR19sOis9zsQPTuSQWq34VaStNg31BlXoCax9LU7FVX9jEoFMb7aeCW5dz+bcS28Orj J7i4uUhCNwBQaHyvdH3W8mhS7aNup682LgJUnceBpbNB7V5ehlhj9N4lAjIlMcxwEeNt BEvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=ThsXXNtl; spf=pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=willy@infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id e8-v6si19020642pgq.333.2018.06.11.07.06.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jun 2018 07:06:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=ThsXXNtl; spf=pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=willy@infradead.org 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==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSNTG-0004nz-3G; Mon, 11 Jun 2018 14:06:58 +0000 From: Matthew Wilcox To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Matthew Wilcox , Jan Kara , Jeff Layton , Lukas Czerner , Ross Zwisler , Christoph Hellwig , Goldwyn Rodrigues , Nicholas Piggin , Ryusuke Konishi , linux-nilfs@vger.kernel.org, Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net 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> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180611140639.17215-1-willy@infradead.org> References: <20180611140639.17215-1-willy@infradead.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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; }