Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp533825ybb; Wed, 8 Apr 2020 05:03:31 -0700 (PDT) X-Google-Smtp-Source: APiQypK3zcwXp2sio+UufStsilh2UX6Xxi8ukrQV0J0L61FQJ9yfPPYOHbkSfHNWGc98YWCFp2wj X-Received: by 2002:a9d:6a95:: with SMTP id l21mr5216892otq.237.1586347410630; Wed, 08 Apr 2020 05:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586347410; cv=none; d=google.com; s=arc-20160816; b=u+SPWOovTAC0njiEZuMwisu2FK+INq+RTQsLbImPn/C0g1LcCP+LCnepPV15nZre/Q ymoNawsP+J0t4pwPgWqPDsNs9wacvx6KmIUlkMCaPAWmmY6r//O5YbDWno45p7oLh+S7 Jh5sy3ZELmQpfHxdNsok/zOlPJMqESzgWbu0S3f4SjUIfq4ZwPfsOvn75jqXzE8kOn0B 0lqMXTG6ri2VXU61GNodIZ0SEohRfEP01LTbsOPL7IgrqG/J2hB3MOdyd75wmQlzg9BA csCcxXzkKdkS7E3cuHEC8zL5ojoDcznWa1lmqFyR99S3DPgzPRIhXycHcmQ6n6DrR2Ik bL0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WzOt0GdNQnN9W8rWLv3kSycAULlc6HEQKX8/oCDxHuU=; b=dGP3AHxnupheQZ3SkTiEQac/hqNqldUX8BJJq6z43GPEWGKoZCHc6vYUeUsfhydyp5 0sVBCiqMdMCxw4gwtgsda7zuU2/ZIK78sqOKpY3SzZ1fWPxUr+0UVQ7RmRlkb42sfyLf P4W/QZ5GzB+EiANcMHY3WhRqICJl8ryfnE8XFzYh0RBbwmTQOOm+29hVWhqBnWwSOB7E S3eo/7fCu014pasT5eJtymkJTBqKkE7DsbVVNQhPRqu6PonH+XtwXFb7JjGnxrisFVeC IP8XMBbpbdMRp0DLxsXOSuiINAdaIQrdV3Xy/SuJjX4kHENqkJYM2mqt/9NUf5V3Y/nG rBPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GMLbPDv5; 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 x189si1901532oia.270.2020.04.08.05.03.01; Wed, 08 Apr 2020 05:03:30 -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=GMLbPDv5; 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 S1728909AbgDHMAg (ORCPT + 99 others); Wed, 8 Apr 2020 08:00:36 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48528 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728845AbgDHMAe (ORCPT ); Wed, 8 Apr 2020 08:00:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=WzOt0GdNQnN9W8rWLv3kSycAULlc6HEQKX8/oCDxHuU=; b=GMLbPDv5CKJVuoIiX6Qpd0FpUQ dPpYg6qQF1jZKryrp6PHJKxeXakwTjTPAtRacgwRzfMttFQ/3S8mMj+ngjyDY0d8gksH5TDW35WMg rHsQFLJLjFMhFtBTRzf1nbgywfs0xdwNxh384zReYJjaRUgVPNSSU5JN2M23dbOcWA0rRmiPEttIO 5KVNv70PJhaSCZPinD4MBT/Ocy8K0cT2epCFc8i/hKnENAsBf6f4WGjWsjTRfd44NwfvyPYg4PgDR P+OFfdp+u3v8tPVn68ns4fPRuGKHVslpBJj5vCgJ+9Y8B4MRBfOqdLaGv888mzrw9td0sRTWMHSYJ hDt03PQw==; Received: from [2001:4bb8:180:5765:65b6:f11e:f109:b151] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jM9NJ-0002pA-RG; Wed, 08 Apr 2020 12:00:10 +0000 From: Christoph Hellwig To: Andrew Morton , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , x86@kernel.org, David Airlie , Daniel Vetter , Laura Abbott , Sumit Semwal , Sakari Ailus , Minchan Kim , Nitin Gupta Cc: Robin Murphy , Christophe Leroy , Peter Zijlstra , linuxppc-dev@lists.ozlabs.org, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/28] mm: pass addr as unsigned long to vb_free Date: Wed, 8 Apr 2020 13:59:09 +0200 Message-Id: <20200408115926.1467567-12-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200408115926.1467567-1-hch@lst.de> References: <20200408115926.1467567-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ever use of addr in vb_free casts to unsigned long first, and the caller has an unsigned long version of the address available anyway. Just pass that and avoid all the casts. Signed-off-by: Christoph Hellwig --- mm/vmalloc.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 9183fc0d365a..aada9e9144bd 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1664,7 +1664,7 @@ static void *vb_alloc(unsigned long size, gfp_t gfp_mask) return vaddr; } -static void vb_free(const void *addr, unsigned long size) +static void vb_free(unsigned long addr, unsigned long size) { unsigned long offset; unsigned long vb_idx; @@ -1674,24 +1674,22 @@ static void vb_free(const void *addr, unsigned long size) BUG_ON(offset_in_page(size)); BUG_ON(size > PAGE_SIZE*VMAP_MAX_ALLOC); - flush_cache_vunmap((unsigned long)addr, (unsigned long)addr + size); + flush_cache_vunmap(addr, addr + size); order = get_order(size); - offset = (unsigned long)addr & (VMAP_BLOCK_SIZE - 1); - offset >>= PAGE_SHIFT; + offset = (addr & (VMAP_BLOCK_SIZE - 1)) >> PAGE_SHIFT; - vb_idx = addr_to_vb_idx((unsigned long)addr); + vb_idx = addr_to_vb_idx(addr); rcu_read_lock(); vb = radix_tree_lookup(&vmap_block_tree, vb_idx); rcu_read_unlock(); BUG_ON(!vb); - vunmap_page_range((unsigned long)addr, (unsigned long)addr + size); + vunmap_page_range(addr, addr + size); if (debug_pagealloc_enabled_static()) - flush_tlb_kernel_range((unsigned long)addr, - (unsigned long)addr + size); + flush_tlb_kernel_range(addr, addr + size); spin_lock(&vb->lock); @@ -1791,7 +1789,7 @@ void vm_unmap_ram(const void *mem, unsigned int count) if (likely(count <= VMAP_MAX_ALLOC)) { debug_check_no_locks_freed(mem, size); - vb_free(mem, size); + vb_free(addr, size); return; } -- 2.25.1