Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4113253imm; Mon, 11 Jun 2018 07:13:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKBYWAAUZ926JqOckO4j6JDvwzrK5tc7TZxY1WWTXRYizMkHVjMDpUDP818jLlEuk7BlyOb X-Received: by 2002:a65:4a04:: with SMTP id s4-v6mr14886309pgq.376.1528726394282; Mon, 11 Jun 2018 07:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528726394; cv=none; d=google.com; s=arc-20160816; b=WwQXLDj8x38rNJTiKhhSNAclb1RvMVR9pxaNFqN1wTzAyJtRgPoHtFuQSJR5jUZypn qj632yPOp1sKnaEDw5p4syelpCbEbbWs8o+GeKAgLRTsAzaRVvM48e9rwMy9zDgdLoM3 26bxb8cjmS8FpkA0feQqM36YXgrJHmZTgON81ES/rsmtQz5+gstyFmdQ52IQO7Amd0yn aN3g874uYyDqFTJFy2hib+kRn0CxbW2NtIKiuyC3gjfAQ1fq0WpxpbxVwXWeiUVUc70d GwAhZzU8NuuVoZA4pmEkn+PTTkqKSxiWl3sTwsFf7mkqHLcdAYJfrKPc1PELqOtNFRMO IjTg== 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=sMEe5HP+nzzouXdOXrYTxqJXjywXPmaQ9Qzg2IJzEoQ=; b=NT50MaabwKB/CK/BhLO7FOsJADd7d0vokRlLHmsE0Z0k++2YQiNHCLXeEmlZ4i2OOX JEJT3RHNrCmD0yz6ouYdWDvfeUA2kVveq0ZwKxLBHGlz0PvPVIxk7zP+TbKT0Rx8D6uU 8cIeDTxhgflXT0zDWacIFyeOAGlJxWS8meWCGU88J5eMJj0su+NqmYq7zspt/wJmbjuz Dl/cd47X1sQ2eeeY+2uD9sKvTbtgZ5JLcX1gAa95q9drNZ+Gk3NSi/cnZU2Nrrq2Zz4v 6OIwYv4ml9qh2SDqQmM5TwiRS8+nREHD6ttnDpOnZoXG/0vmvXuqcuvDQxSVCWF34ChL Kllg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BAdkMUBW; 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 m37-v6si47103879plg.491.2018.06.11.07.12.59; Mon, 11 Jun 2018 07:13:14 -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=BAdkMUBW; 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 S933691AbeFKOLo (ORCPT + 99 others); Mon, 11 Jun 2018 10:11:44 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46230 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933608AbeFKOHF (ORCPT ); Mon, 11 Jun 2018 10:07:05 -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=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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.17.1