From patchwork Sun Jun 17 02:00:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10468273 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 806A0603B4 for ; Sun, 17 Jun 2018 02:03:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 702DB28C6A for ; Sun, 17 Jun 2018 02:03:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64FBA28C75; Sun, 17 Jun 2018 02:03:02 +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 ECD2828C6A for ; Sun, 17 Jun 2018 02:03:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 46F4B6B027F; Sat, 16 Jun 2018 22:01:13 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3A7696B0283; Sat, 16 Jun 2018 22:01:13 -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 1FB886B0284; Sat, 16 Jun 2018 22:01:13 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f71.google.com (mail-pl0-f71.google.com [209.85.160.71]) by kanga.kvack.org (Postfix) with ESMTP id C3ED76B027F for ; Sat, 16 Jun 2018 22:01:12 -0400 (EDT) Received: by mail-pl0-f71.google.com with SMTP id e1-v6so7646710pld.23 for ; Sat, 16 Jun 2018 19:01:12 -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=jlPJjd97phkgtLpaFqwtKpwhcV6aMOInwpP/oXccAJE=; b=StYiKfH0EVXpuJd4ZH3E55CEH9KYHRbxOyU+6XISPWRQcNA4nlTEkcP0SoUHRrBlTO 2qfSzxrZQoTcokXQk77S9+qOWrGb5pOK5CpZZ00fSzAyR0h5VF8Bgi3eOw/QrgzzSzFs RBKPufuknWrQn5h43m+2DxE7TFMW5r8kIr8AjmHTqR96KmR5dXfsG9CI7JAc43yNO+LX F3f7sNo+qIGVot8epKJTYYLmQ7LhM849S9bYE1AQ/+sR15DdoqC9Lde12hU3ikSjHiAc omntCV9JP9LuBT7+hia87Y3CiWqNd8Xs/ffpZREl34zjOk6TDX8sDdoaEWXAmzNpomQ0 V+mw== X-Gm-Message-State: APt69E3AloMy6LL6GjCIxUaW6gCov/WknLtDumPD/7A8CVOK6B8/rJF6 oz88ykfsqRSM05BR46012jLbezxDum8cui7JWM33zTAjHQeoDk6OsYo6RprdXWase0Iu2Qldhi0 hoRbn6HRSj4n0z1+D4tOudU5ANEUOptN4Yt1yJLQWnSz52ZldFTpphtUXn5/rCDSdrg== X-Received: by 2002:a17:902:3281:: with SMTP id z1-v6mr8518060plb.226.1529200872510; Sat, 16 Jun 2018 19:01:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJiQ7Dq8dmCRW1t5tt4iXHbVinSPFGrp2JdfgUvtwZ6HCVAyzp62Oy2ImRFkj9kJ04s5wHl X-Received: by 2002:a17:902:3281:: with SMTP id z1-v6mr8518031plb.226.1529200871808; Sat, 16 Jun 2018 19:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529200871; cv=none; d=google.com; s=arc-20160816; b=WD6D7+k37kMO8tggWXqbK3ZP7yjgI42g/k+u1ZBg6t/3o+G4mtYnuDfLxuRRh2Docz e7ZducHMWtX3XhSdwitaHZbgt/FRNimcjbmMuphS+DbpDD65jjmaR9ziydukZkgDsY/r +LDBm0bG0sXu6uSMBbjlyQowAyi4zEMiYk0kxT6OgwwZDzPFDpBwc66/Gx+SkwiSerUk X0IOynG8CBKns1rDiXdKsQWGkVHRxMY1RR6PrcxDKTP1rPwgEcJs+pMI6PQUT4b4OxJX DCnfI5WzQCexfVe/hOcGvvU+9zJvnET0lTOgEEfr5QsBmll3YMt1FJersvDV8DrJxidn p9ng== 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=jlPJjd97phkgtLpaFqwtKpwhcV6aMOInwpP/oXccAJE=; b=L7ps3NZOcyASdcSnLSaEdYJyZNeK2dP5wymrpgpcC0MsXdn4+m9nB25y/J+r9Eu5GY 8IFYySbg4+q06xVLmAPxITd/dSdz33bMvW0/5kBmU2Cjkj8lC66yOaJTVf/55QRXlagZ YaXK89Yc9G84exXxiKyRib5milWAdP7IalJxGW8IdsKyTOyBy/Q/93Y7JLr2abybhppm mSlmEStqvjNTGcya1403RoRHqkd3EhMbi5a62Veb3gGrAuqOKPbSs3kYqO5Q46nNIQ+R KWxO8ESzaCbC4vGi8LbfAmN7hXtWwiXSKvVQ4QLQtklxDPb/i7l6Q/vDqEsG60RSfLJ2 8C8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=hWK1Br71; 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 u76-v6si11888112pfj.58.2018.06.16.19.01.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Jun 2018 19:01:11 -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=hWK1Br71; 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=jlPJjd97phkgtLpaFqwtKpwhcV6aMOInwpP/oXccAJE=; b=hWK1Br71IXraKoB6WwcincedS yWb6z9VzFKd2qCNUwYvcUCz/ZkBSH3pTmCnZcM8VhWwzsurZVKs/y2ioqp/4693fTfYXgfz+vx944 NsdOdcv1YLUgbu+EArt8hB3HROEw8AxJYF6mGcNneDhanlqjsiXRiE2OlmSZQ0pwAj0XqLys/X3Nr tKf7bEjnqsaTxWaNYMRXXWoJz3BSU4R8+p3JPT/Z7eMsY9lV/N0jg0rwr4DQ8aMW7ByQeQF63ysQn 7qnYe+4ERWy1PNu7PqKEeli0cpvPhFfeHduHsbbrR99rf86PZNRIUfNNETuJb7IaIR4DuBEKt+9Wq BXCNe+gLg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUN0A-0001PJ-Jz; Sun, 17 Jun 2018 02:01:10 +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 v14 52/74] shmem: Convert shmem_free_swap to XArray Date: Sat, 16 Jun 2018 19:00:30 -0700 Message-Id: <20180617020052.4759-53-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180617020052.4759-1-willy@infradead.org> References: <20180617020052.4759-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 Since we are conditionally storing NULL in the XArray, we do not need to allocate memory and the GFP flags will be unused. Signed-off-by: Matthew Wilcox --- mm/shmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 09452ca79220..9dbbdd5dee30 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -653,7 +653,7 @@ static void shmem_delete_from_page_cache(struct page *page, void *radswap) } /* - * Remove swap entry from radix tree, free the swap and its page cache. + * Remove swap entry from page cache, free the swap and its page cache. */ static int shmem_free_swap(struct address_space *mapping, pgoff_t index, void *radswap) @@ -661,7 +661,7 @@ static int shmem_free_swap(struct address_space *mapping, void *old; xa_lock_irq(&mapping->i_pages); - old = radix_tree_delete_item(&mapping->i_pages, index, radswap); + old = __xa_cmpxchg(&mapping->i_pages, index, radswap, NULL, 0); xa_unlock_irq(&mapping->i_pages); if (old != radswap) return -ENOENT;