Received: by 10.192.165.156 with SMTP id m28csp469385imm; Fri, 13 Apr 2018 02:18:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+/8X6c3IHE2fWbBmSQNxELPgqkmnsRHfXKDhtYmRn9NCK9mJM6KEaeVa1gHX//LNgY9ufp X-Received: by 10.167.133.198 with SMTP id z6mr2577505pfn.38.1523611120206; Fri, 13 Apr 2018 02:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523611120; cv=none; d=google.com; s=arc-20160816; b=fooMPTD2Guu5DSjdYiTzrKkMH7C1pGqkObgphBRL3joMk9d1AsVwFlFb1YxfM/twq+ HeIxPaktBxUwAU8EwQrGX3m2s9x/mED29XaQx3M6nPWQXnLvUCyhZ4tJp0QkqIvDEPvZ oddd8owK512gPTH0jCB0CEW/HEKuMFB1hzs6UTgfXBYW2/suAFZ/UaO1kufUJkdfDNFF gzbPHpwfk5TJLgnVQ6vto49Cfal2Na0URua/ESp574k4q9h/wv8Od58sC/wx4nsBnliG N/el8e/ZTWrnnDSg9J95ZXhAjRqWWtITHklr7wQn41w+q11mBfsvZllcbtMTtZEG7S1I W6dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=rcA4X2Fb3BLzXAgT5COnGPnCEb47SCGxlTER1EHjWKU=; b=hSnQjqmqi7R1IWvcVwAeghIOXWwMFfYJhbaCaE3BtUQfANSwt2fmzH0dhgxCQSVUUY cZO8YFnVhHRMbdmBHr+7Yd3iWRAfFdZ9UQCF1wPrA8L4gp90yKmIAlPK3RsvlWFFy7ug Bzph4o3X411AM/hcyj1XXjGX7KR4rzVF9B5oBZAfBz8mGf2sdpZ5yICqtIs/QcXeSpR+ qy7IJ7LUGowG+oS2G5to85cKtbTXmeuIYm1aM9qt/h/BnU4rFEGb3Ho3uGcxKJOlMKa0 QlsdPeNsxFIRNLptYv5CZYdAG4BdnAlctPR5BL4Pn1/PI5BcKGDCCf+uFbD7m+oTDVmO 0jrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=oHtcDWOt; dkim=pass header.i=@codeaurora.org header.s=default header.b=FO4oJJ37; 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 f188si4146119pfc.316.2018.04.13.02.18.25; Fri, 13 Apr 2018 02:18:40 -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=pass header.i=@codeaurora.org header.s=default header.b=oHtcDWOt; dkim=pass header.i=@codeaurora.org header.s=default header.b=FO4oJJ37; 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 S1754086AbeDMJRS (ORCPT + 99 others); Fri, 13 Apr 2018 05:17:18 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:58928 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752929AbeDMJRR (ORCPT ); Fri, 13 Apr 2018 05:17:17 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1C833601D7; Fri, 13 Apr 2018 09:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523611037; bh=33Tt3GSxYBwffOYbjYdnhBjLul02sk356wSjgbwryKw=; h=From:To:Cc:Subject:Date:From; b=oHtcDWOtzZyaILtCNwXUnDkcZe1m1ohodtiyX/MAMPOb9Q/wTUIzqZ0xq0UuVPEVt iknQYThjON5NKtAFIpR6Q57gAt3S+lWrA/E0ixITbkgSVIyMXmHyZzY7i+w5XyuKrF V/zklde9C4ku22Wa4GpJNjmdj1q4w9XXBNL02/jg= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from cpandya-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cpandya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 962666076A; Fri, 13 Apr 2018 09:17:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523611036; bh=33Tt3GSxYBwffOYbjYdnhBjLul02sk356wSjgbwryKw=; h=From:To:Cc:Subject:Date:From; b=FO4oJJ37ASG/MqvBfQejC0psDkdmgBw/+7eRsGtaLTchBrr/dsxEAPqjXkW+r0HE7 aEB5y6yySEq22D4BFMtooztN/S6VOTTLmwqeLMwVgDDg9sI2HlxzlY35DYb/4oY6ho /flbeilTyAh0rdLEAEX31vvRYGVXNOo0dKpJTLG0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 962666076A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cpandya@codeaurora.org From: Chintan Pandya To: vbabka@suse.cz, labbott@redhat.com, catalin.marinas@arm.com, hannes@cmpxchg.org, f.fainelli@gmail.com, xieyisheng1@huawei.com, ard.biesheuvel@linaro.org, richard.weiyang@gmail.com, byungchul.park@lge.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chintan Pandya Subject: [PATCH] mm: vmalloc: Remove double execution of vunmap_page_range Date: Fri, 13 Apr 2018 14:46:59 +0530 Message-Id: <1523611019-17679-1-git-send-email-cpandya@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unmap legs do call vunmap_page_range() irrespective of debug_pagealloc_enabled() is enabled or not. So, remove redundant check and optional vunmap_page_range() routines. Signed-off-by: Chintan Pandya --- mm/vmalloc.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index ebff729..920378a 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -603,26 +603,6 @@ static void unmap_vmap_area(struct vmap_area *va) vunmap_page_range(va->va_start, va->va_end); } -static void vmap_debug_free_range(unsigned long start, unsigned long end) -{ - /* - * Unmap page tables and force a TLB flush immediately if pagealloc - * debugging is enabled. This catches use after free bugs similarly to - * those in linear kernel virtual address space after a page has been - * freed. - * - * All the lazy freeing logic is still retained, in order to minimise - * intrusiveness of this debugging feature. - * - * This is going to be *slow* (linear kernel virtual address debugging - * doesn't do a broadcast TLB flush so it is a lot faster). - */ - if (debug_pagealloc_enabled()) { - vunmap_page_range(start, end); - flush_tlb_kernel_range(start, end); - } -} - /* * lazy_max_pages is the maximum amount of virtual address space we gather up * before attempting to purge with a TLB flush. @@ -756,6 +736,7 @@ static void free_unmap_vmap_area(struct vmap_area *va) { flush_cache_vunmap(va->va_start, va->va_end); unmap_vmap_area(va); + flush_tlb_kernel_range(va->va_start, va->va_end); free_vmap_area_noflush(va); } @@ -1142,7 +1123,6 @@ void vm_unmap_ram(const void *mem, unsigned int count) BUG_ON(!PAGE_ALIGNED(addr)); debug_check_no_locks_freed(mem, size); - vmap_debug_free_range(addr, addr+size); if (likely(count <= VMAP_MAX_ALLOC)) { vb_free(mem, size); @@ -1499,7 +1479,6 @@ struct vm_struct *remove_vm_area(const void *addr) va->flags |= VM_LAZY_FREE; spin_unlock(&vmap_area_lock); - vmap_debug_free_range(va->va_start, va->va_end); kasan_free_shadow(vm); free_unmap_vmap_area(va); -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project