From patchwork Fri Dec 15 14:09:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10115205 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 C606C602C2 for ; Fri, 15 Dec 2017 14:11:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A64F929F63 for ; Fri, 15 Dec 2017 14:11:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B41E29F6D; Fri, 15 Dec 2017 14:11:01 +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=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6721529F63 for ; Fri, 15 Dec 2017 14:11:01 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2D79B2217CE46; Fri, 15 Dec 2017 06:06:19 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: None (no SPF record) identity=mailfrom; client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=batv+f9b51a8ca15fdac5c6a2+5227+infradead.org+hch@bombadil.srs.infradead.org; receiver=linux-nvdimm@lists.01.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 21ECC2216D8F6 for ; Fri, 15 Dec 2017 06:06:18 -0800 (PST) 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=KrKIRXbU1mopnwv6LWLisWLB3qK5oeRqW0Y56qFsdak=; b=J+CGoOvRe7R1GhJ8BBGRD8QDP ci2r59NQ7Uh2fn4VCoJE9vt0GI4U9q1LQIErri4+4rqTzgYVRTfBBrgmugfgvV7+5ATCy+sPmxJYz 6L+09aeymUqTyWQHLtB2/DprKWuSKw3ect+SPW3+oekrGvuTFLFKT2b7TgBNjqE1wpIHu2QCR4qpM nZxXDVJyPJsEmf+QuxWlO6zM65UA/Pd6EqF3JJcki/3Q0j8QFwOcjnqaMe/ECiDVSC/9nCP2mgTbn u+/aZyQgro+0syidlfFyByIKj+alM5leP3M6vEMIDyLWNr9b72+tmO4UEOgXb0LEONkqbEqv1OTOJ uTfd2Zlgg==; Received: from 77.117.211.202.wireless.dyn.drei.com ([77.117.211.202] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1ePqhW-0001wa-IC; Fri, 15 Dec 2017 14:10:59 +0000 From: Christoph Hellwig To: Dan Williams Subject: [PATCH 14/17] memremap: simplify duplicate region handling in devm_memremap_pages Date: Fri, 15 Dec 2017 15:09:44 +0100 Message-Id: <20171215140947.26075-15-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171215140947.26075-1-hch@lst.de> References: <20171215140947.26075-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nvdimm@lists.01.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , linuxppc-dev@lists.ozlabs.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP __radix_tree_insert already checks for duplicates and returns -EEXIST in that case, so remove the duplicate (and racy) duplicates check. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe --- kernel/memremap.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/kernel/memremap.c b/kernel/memremap.c index 891491ddccdb..901404094df1 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c @@ -395,17 +395,6 @@ void *devm_memremap_pages(struct device *dev, struct resource *res, align_end = align_start + align_size - 1; foreach_order_pgoff(res, order, pgoff) { - struct dev_pagemap *dup; - - rcu_read_lock(); - dup = find_dev_pagemap(res->start + PFN_PHYS(pgoff)); - rcu_read_unlock(); - if (dup) { - dev_err(dev, "%s: %pr collides with mapping for %s\n", - __func__, res, dev_name(dup->dev)); - error = -EBUSY; - break; - } error = __radix_tree_insert(&pgmap_radix, PHYS_PFN(res->start) + pgoff, order, page_map); if (error) {