From patchwork Mon Jun 11 14:06:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10457987 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 426036020F for ; Mon, 11 Jun 2018 14:10:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26AF528723 for ; Mon, 11 Jun 2018 14:10:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21D202864E; Mon, 11 Jun 2018 14:10:42 +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 D1B3928678 for ; Mon, 11 Jun 2018 14:10:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 134BA6B0294; Mon, 11 Jun 2018 10:07:07 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 06B2A6B0296; Mon, 11 Jun 2018 10:07:07 -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 E4BC36B0294; Mon, 11 Jun 2018 10:07:06 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f70.google.com (mail-pl0-f70.google.com [209.85.160.70]) by kanga.kvack.org (Postfix) with ESMTP id 984A46B0295 for ; Mon, 11 Jun 2018 10:07:06 -0400 (EDT) Received: by mail-pl0-f70.google.com with SMTP id bf1-v6so12218000plb.2 for ; Mon, 11 Jun 2018 07:07:06 -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=sMEe5HP+nzzouXdOXrYTxqJXjywXPmaQ9Qzg2IJzEoQ=; b=cGFQsKo/8yBOxvyvqri1+T4N3il69K+tsPaPWmGkVvoT3HulG2kQ7e6/XHHiEr7tNd 7GPBaiajtKNZnCNUomzlFnqTtRdqt97/fcGeuAot/353JmzzaCzFCUToWN5hpwpIxQDl SmQnVXD8St016OK9pX3fppZdL89fybv0st6X6j6ZbS/BV21TjL/eUVWyTUUuE7gkoeHR /K8rQjNKwtjBXn0V8Vy02jll80W+O0IxOnNhND+pl79talKIEppBQ3WEdplbqOJXksZy iNRc++exDATHlN/QesZClp43EAiPpZpsCyoERkWHB8p9QWonUFamtJ+PiwzynGrJ1GPM e0Jg== X-Gm-Message-State: APt69E1Msqdc1usuAwaaNC5R4w0/UCru2Rofymj15eI4qgdRLWMsAQfp xB1DnCheipPje3M0t7nt14FXGPhhgVldTol+MoEo22XmGD6G1CALO22U8RQ9qtsUzfyp1k8Uv8Z G1UJ1HKR/FDlHykSG8xCR2p/lA+Tf6D66YZpI5IvIgyXJ23GpPJMZohGfVdPVo3KtFA== X-Received: by 2002:a17:902:7048:: with SMTP id h8-v6mr18752095plt.269.1528726026339; Mon, 11 Jun 2018 07:07:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJCVI8KVfBIIsBEENil1Ihp9ik/76K3kahbjxftn33U1P/d62S9XplvK1u9nsrWDCiJfT2A X-Received: by 2002:a17:902:7048:: with SMTP id h8-v6mr18752052plt.269.1528726025618; Mon, 11 Jun 2018 07:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528726025; cv=none; d=google.com; s=arc-20160816; b=fczunEmV1pPJp68BKOH2NlYiqD+qq37WbxKFRR8Tq8SXa53eEaqaOyF2s7dAj4ZDNC MpOFoUqNokfypxKbz7iQhv2Rw6Ku7gUnhtKZYqQI0ZkVKM5B4UmfsPXvyiHcF7o1FRAU QIkh8/T7gvaoh9JA3zmrHrqLVC55DIwu6WtLApfo9+gsTAs8MSnuXKvnZVuiZPRhJazT 9PaUEhuD7B/JTxCVNp7Dg2RE2L2aqyQbXR3gqRShhAAgs/BxFlS4+zjqWIgDDW6GnPXx FmorsYzGh3P5DtFA3H7dtTQbQgH0ydjUQVKoCAjv+pqvDDInBi4yd4Vjv26ymA9gmrdq JSkQ== 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=sMEe5HP+nzzouXdOXrYTxqJXjywXPmaQ9Qzg2IJzEoQ=; b=HWuSHiN8WplejqJYT5OAgV85CMcqL3owxh2dS3ZksAldKB33KIMRfttVk5E7zcClpl UA0m+lWi1AFO/G0wpz6PDHi4ipwE3l3BllRE6v9zrdklmZFQPaFe9NApl+I5KuU0O4Y7 SBQOVZXlL1waW2DkWwBYOq0OhghMpVi2s2lC36qPkyEHPtKlhP7dR4jB3W4/EnSMkuVy 8HqdL40lbCwjL8XuETJKhNbIXogNGHtk8x20L05HbLxUqY/urOjl6mKxd3QE7rg/M+aI /gUzV0+NndkChvrOp7c2C2dnNZDPWUe/K3WfMMO/luR/CsTEmF5Q86zBddktJ5GejsNd n+NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=BAdkMUBW; 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 j33-v6si63801260pld.151.2018.06.11.07.07.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jun 2018 07:07:05 -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=BAdkMUBW; 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=sMEe5HP+nzzouXdOXrYTxqJXjywXPmaQ9Qzg2IJzEoQ=; b=BAdkMUBWwoPl4SbrSwOFcauPR 1k5+zQNA7G3io1pMKMht6mSNi23R8hpLQWPacMuNGi+mTu0n0/g5nYmpSULVJdqkYSgHwTLWp0f6n R2C28uyfYVJhC3V8wL43WAGOs4HXaMAMb5Tc4jLRtkGAhFiVDYNFJRq/0NS6bX+zMzjQj7X3XH8uK GMBDBaiWA7wuQissHUEVQxz16XpY/BMNXOY3Vf9sdjg8UcKlWHf1zKWWxpsSDPuVHq/511migTF2o qVrcrSLJYGQORjoGMkt5vQM1TlPATNpZ+j1OwLx8e97jC0kzfUbBfFOO2jqQI2MK9DSzT/YFSEmCi 1fnn6nOpQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSNTM-0004uG-DR; Mon, 11 Jun 2018 14:07:04 +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 51/72] shmem: Convert shmem_free_swap to XArray Date: Mon, 11 Jun 2018 07:06:18 -0700 Message-Id: <20180611140639.17215-52-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 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;